Private Sub ActiveWindowExample()
Msg = "Want to close the active window?"
Title = "ActiveWindow Example"
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
Application.ActiveWindow.Close
End If
End Sub