Set application = WScript.CreateObject("PowerPoint.Application")
Set presentation = application.ActivePresentation

If application.SlideShowWindows.Count > 0 Then
	Set slideshow = application.SlideShowWindows.Item(1)
End If

If IsNull(slideshow) Or IsEmpty(slideshow) Then
	presentation.SlideShowSettings.Run
Else
	slideshow.View.Exit
End If

Set WshShell = CreateObject("WScript.Shell")

Set PowerPointProcessList = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("SELECT * FROM Win32_Process WHERE Name='POWERPNT.EXE'")

If Not PowerPointProcessList Is Nothing Then
	For Each objProcess In PowerPointProcessList
		WshShell.AppActivate(objProcess.ProcessId)
		Exit For
	Next
End If