VBA/Excel/Access/Word/PowerPoint/ActivePresentation — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 19:33, 26 мая 2010
Содержание
- 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
<source lang="vb">
Sub saveAs()
If ActivePresentation.Path = "" Then ActivePresentation.SaveAs FileName:="C:\C.ppt" Else ActivePresentation.Save End If
End Sub
</source>
Closing a Window
<source lang="vb">
Sub close()
Do While ActivePresentation.Windows.Count > 1 ActivePresentation.Windows(ActivePresentation.Windows.Count).Close Loop
End Sub
</source>
Saving a Copy of a Presentation
<source lang="vb">
Sub saveCopy()
ActivePresentation.SaveCopyAs FileName:="C:\Copy 1.ppt"
End Sub
</source>
Use the Save method to save a presentation before closing its last window
<source lang="vb">
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
</source>
Working with the Active Presentation
<source lang="vb">
"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
</source>