×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Issue with Powerpoint VBA/VBScript - Presentations opening behind windows explorer/unactivated

Issue with Powerpoint VBA/VBScript - Presentations opening behind windows explorer/unactivated

Issue with Powerpoint VBA/VBScript - Presentations opening behind windows explorer/unactivated

(OP)
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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close