VBA/Excel/Access/Word/PowerPoint/ActivePresentation

Материал из VB Эксперт
Версия от 15:46, 26 мая 2010; Admin (обсуждение | вклад) (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

   <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>