VBA/Excel/Access/Word/PowerPoint/ActivePresentation
Содержание
- 1 Check the Path property of the Presentation object before using the Save method if you need to determine whether the presentation has been saved
- 2 Closing a Window
- 3 Saving a Copy of a Presentation
- 4 Use the Save method to save a presentation before closing its last window
- 5 Working with the Active Presentation
Check the Path property of the Presentation object before using the Save method if you need to determine whether the presentation has been saved
Sub saveAs()
If ActivePresentation.Path = "" Then
ActivePresentation.SaveAs FileName:="C:\C.ppt"
Else
ActivePresentation.Save
End If
End Sub
Closing a Window
Sub close()
Do While ActivePresentation.Windows.Count > 1
ActivePresentation.Windows(ActivePresentation.Windows.Count).Close
Loop
End Sub
Saving a Copy of a Presentation
Sub saveCopy()
ActivePresentation.SaveCopyAs FileName:="C:\Copy 1.ppt"
End Sub
Use the Save method to save a presentation before closing its last window
Sub active()
With ActivePresentation
If .Path = "" Then
MsgBox "Please save this presentation.", vbOKOnly
Else
.Save
For Each myWindow In Windows
.Close
Next myWindow
End If
End With
End Sub
Working with the Active Presentation
"Check that a window is open before you access the ActivePresentation object.
Sub count()
If Windows.Count = 0 Then
MsgBox "Please open a presentation before running this macro."
End
End If
End Sub