WindowDeactivate Event

Microsoft PowerPoint Visual Basic

Show All

WindowDeactivate Event

       

Occurs when the application window or any document window is deactivated.

Private Sub application_WindowDeactivate(ByVal Pres As Presentation, ByVal Wn As DocumentWindow)

application   An object of type Application declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Pres   The presentation displayed in the deactivated window.

Wn   The deactivated document window.

Example

This example finds the file name (without its extension) for the presentation in the window that is being deactivated. It then appends the .htm extension to the file name and saves it as a Web page in the same folder as the presentation.

Private Sub App_WindowDeactivate _         (ByVal Pres As Presentation, ByVal Wn As DocumentWindow)
    FindNum = InStr(1, Wn.Presentation.FullName, ".")
    If FindNum = 0 Then
        HTMLName = Wn.Presentation.FullName & ".htm"
    Else
        HTMLName = Mid(Wn.Presentation.FullName, 1, FindNum - 1) _
            & ".htm"
    End If
    Wn.Presentation.SaveCopyAs HTMLName, ppSaveAsHTML
    MsgBox "Presentation being saved in HTML format as " _
        & HTMLName & " ."
End Sub