VBA/Excel/Access/Word/PowerPoint/ActivePresentation

Материал из VB Эксперт
Перейти к: навигация, поиск

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