PowerPoint 2010 VBA using Presentation.Open newly opened presentation hides behind original presentation upon end sub
Thursday, December 06, 2012 3:35 AM
I am running a macro to open a presentation as selected by user. I cannot use a hyperlink because the first presentation runs in kiosk mode and I need the "chosen" presentation to run in speaker. when I hyperlink it runs in kiosk.
It is a simple macro that uses presentation.open to open a pptx. This works fine on most versions of powerpoint. (tested on 32 bit office 2010 running on 64 bit machine OK ppt 2007-ok)
However, when running on PPT 2010 on a 32 bit machine the newly opened presentation hides behind the current presentation as soon as the macro finishes. (If I sleep the macro the new presentation will stay in the foreground until the sleep finishes.) .Activate in that macro does not help. If I then .Activate the presentation from a macro launched from a new button it comes to the front.
This behavior only manifests on 32 bit machine running ppt 2010.
I cannot understand why I cannot find anyone else talking about this issue. It is such a simple macro it should be aproblem cropping up everywhere... What am I missing this must be simple.
This is a test sample of the code that fails:
Dim oPres As Presentation
Set oPres = Presentations.Open("C:\Users\All Others\Desktop\Presentation1.pptx", _
True, , False)
.ShowType = ppShowTypeSpeaker ' or ppShowTypeKiosk etc
.LoopUntilStopped = msoTrue
.ShowWithNarration = msoTrue
.ShowWithAnimation = msoTrue
.RangeType = ppShowAll
.AdvanceMode = ppSlideShowUseSlideTimings
.PointerColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
Launching this from a separate button brings to front:
Any help would be appreciated.
- Edited by JoeYoe Friday, December 07, 2012 6:58 AM Typo
Friday, December 07, 2012 6:21 AMModerator
Thanks for posting in the MSDN Forum.
I never see Presentation interface have Active property or method. Would you please clarify it?
Have a good day,
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Friday, December 07, 2012 6:46 AM
Thank you for the reply.
Sorry, I doublechecked. The actual code reads:
in both instances above.
I played around with so many different options to fix it that I retyped that part from memory and goofed it.
Nevertheless, the presentation hides in the back (as window 2) as soon as the sub ends. the only way to bring it up to the top is by activating it through another macro from a fresh "click". It seems to me that VBA is returning focus to the original presentation upon exiting, and this only happens when the second presentation did not exist when the code began. Again, I tried this on several different systems. The only time I get this issue is on Windows 7 32 bit running ppt 2010. I have reproduced the error on 2 computers.
I do not get this issue at all in PPT 2007.
I do not get this issue at all running PPT 2010(32bit) on a 64 bit machine.
I hope I've clarified that, Thank you.
I edited my original post to correct for that.
- Edited by JoeYoe Friday, December 07, 2012 7:02 AM Corrected orig. post