Set WshShell = WScript.CreateObject("WScript.Shell")
Set application = WScript.CreateObject("PowerPoint.Application")

If application.SlideShowWindows.Count > 0 Then
	Call Err.Raise(60002, , "PowerPoint is in presentation mode. Cannot perform operation.")
Else
	WshShell.AppActivate("PowerPoint")
	WshShell.SendKeys "%"
	WshShell.SendKeys "H"
	WshShell.SendKeys "FO"
End If