Hi everyone. I am new here!
I have code to open a presentation from a VBScript file:
Set oApp = CreateObject("Powerpoint.Application")
oApp.visible = true
Set oPres = oApp.Presentations.Open("\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm")
oApp.Run "\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm!Open_Presentation"
This triggers running a macro in the file which opens another PowerPoint presentation.
Everything opens fine, the problem I have is that when running the open of the first presentation from the VBScript file, it opens behind the windows explorer menu and a notification for it opening flashes on the windows toolbar. This doesn't happen when running the macro direct from the PowerPoint file.
This causes a problem later on in my code because I have a trigger for slideshows to run. Due to the flashing notification on the toolbar this prevents them from opening automatically and I have to click on them individually/ users have to click individually. It is really annoying.
I have tried adding VBA code into the presentation to maximise the presentations and then minimise to act as if it had been opened. I have tried sendkeys added into the vbscript to minimise other windows. None of it has worked.
I noticed strange behaviour where the code runs perfectly if I run it from within the the vba editor of PowerPoint. However, when running from within PowerPoint, but not in the editor (from the "view macros" area), code I have wrote to hide the toolbar won't hide because it triggers notifications for each thing opening. This doesn't happen from within the editor.
I checked this and added a sendkeys line of code to my vbs opening routine (and one at the end to close it, these open the VBE editor and close it, NOT the presentations):
Set oApp = CreateObject("Powerpoint.Application")
Set objShell = WScript.CreateObject("WScript.Shell")
oApp.visible = true
Set oPres = oApp.Presentations.Open("\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm")
objShell.AppActivate "Stand Up Title Page - With Macros"
objShell.SendKeys "%{F11}"
oApp.Run "\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm!Open_Presentation"
objShell.SendKeys "%{F4}"
This makes everything open perfectly! However I have two questions/problems:
1. Why? I really can't understand why this is happening and want to understand - anybody know?
2. Is there a way to make just the window triggered with SendKeys invisible? (The vba developer/editor window). It is better than it not openeing properly by including this code, but it is annoying to have this pop up everytime someone opens it.
Thanks in advance!
I have code to open a presentation from a VBScript file:
Set oApp = CreateObject("Powerpoint.Application")
oApp.visible = true
Set oPres = oApp.Presentations.Open("\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm")
oApp.Run "\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm!Open_Presentation"
This triggers running a macro in the file which opens another PowerPoint presentation.
Everything opens fine, the problem I have is that when running the open of the first presentation from the VBScript file, it opens behind the windows explorer menu and a notification for it opening flashes on the windows toolbar. This doesn't happen when running the macro direct from the PowerPoint file.
This causes a problem later on in my code because I have a trigger for slideshows to run. Due to the flashing notification on the toolbar this prevents them from opening automatically and I have to click on them individually/ users have to click individually. It is really annoying.
I have tried adding VBA code into the presentation to maximise the presentations and then minimise to act as if it had been opened. I have tried sendkeys added into the vbscript to minimise other windows. None of it has worked.
I noticed strange behaviour where the code runs perfectly if I run it from within the the vba editor of PowerPoint. However, when running from within PowerPoint, but not in the editor (from the "view macros" area), code I have wrote to hide the toolbar won't hide because it triggers notifications for each thing opening. This doesn't happen from within the editor.
I checked this and added a sendkeys line of code to my vbs opening routine (and one at the end to close it, these open the VBE editor and close it, NOT the presentations):
Set oApp = CreateObject("Powerpoint.Application")
Set objShell = WScript.CreateObject("WScript.Shell")
oApp.visible = true
Set oPres = oApp.Presentations.Open("\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm")
objShell.AppActivate "Stand Up Title Page - With Macros"
objShell.SendKeys "%{F11}"
oApp.Run "\\nuth-dept02\Stand Up Meeting Group\Stand Up Wall Presentation Files - Updated\Stand Up Title Page - With Macros.pptm!Open_Presentation"
objShell.SendKeys "%{F4}"
This makes everything open perfectly! However I have two questions/problems:
1. Why? I really can't understand why this is happening and want to understand - anybody know?
2. Is there a way to make just the window triggered with SendKeys invisible? (The vba developer/editor window). It is better than it not openeing properly by including this code, but it is annoying to have this pop up everytime someone opens it.
Thanks in advance!