Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to identify the newest window in PowerPoint for Mac 2011

Posted on 2014-09-03
5
Medium Priority
?
267 Views
Last Modified: 2014-09-05
Hopefully a simple question.  VBA macro on a toolbar in PowerPoint for Mac 2011.  I create a new document based on a template, then want to manipulate the newly created window.  The new document opens fine, but its window is NOT automatically the active window.  I've tried to address newdeck.windows(1), application.windows(1), or application.windows(application.windows.count), but none of them seems to work.  How can I reliably identify the window just created with the new document?

Sub NewPresentation()

Dim newdeck As Presentation

file2open = contentlibraryfolder & ":Templates:HPC Template.potx"

Set newdeck = Application.Presentations.Open(fileName:=file2open, Untitled:=msoTrue)

'HERE IS WHERE I AM ASSUMING THE NEWEST CREATED WINDOW (NEWDECK) SHOULD BE THE ACTIVEWINDOW, BUT NOT SO

ActiveWindow.ViewType = ppViewNormal
ActiveWindow.View.Zoom = 100
ActiveWindow.WindowState = ppWindowMaximized

End Sub

Open in new window

0
Comment
Question by:Bryce Bassett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Rgonzo1971
ID: 40302857
Hi,

Do you get more than one window  with

newdeck.Windows.Count

newdeck.Windows(1).Activate

Regards
0
 
LVL 23

Expert Comment

by:JSRWilson
ID: 40303933
Or maybe
newdeck.Windows(1).ViewType = ppViewNormal
0
 

Author Comment

by:Bryce Bassett
ID: 40305104
Still not working correctly.   Here are some additional clues.  

Just after creating newdeck, if I try this:
newdeck.Windows(1).ViewType = ppViewNormal
newdeck.Windows(1).View.Zoom = 100
newdeck.Windows(1).WindowState = ppWindowMaximized

Open in new window

I get a silly error that says "Integer out of range.  1 is not in the valid range of 1 to 0."

Just after creating newdeck, if I insert: "MsgBox newdeck.Windows.Count" it displays "0".  Then when I close the msgbox, the rest of the code executes correctly, whether I use
newdeck.Windows(1).ViewType = ppViewNormal
newdeck.Windows(1).View.Zoom = 100
newdeck.Windows(1).WindowState = ppWindowMaximized

'OR

ActiveWindow.ViewType = ppViewNormal
ActiveWindow.View.Zoom = 100
ActiveWindow.WindowState = ppWindowMaximized=

Open in new window

Weird.  Something about the msgbox is kicking the tires and forcing newdeck to become the active window.  But of course I don't want the user to have to close a msgbox.   I tried opening a modeless dummy form, then closing it, but it still freezes the action.   Any other suggestions for a workaround for what seems to be a bug?
0
 
LVL 23

Accepted Solution

by:
JSRWilson earned 2000 total points
ID: 40305654
I'm not a Mac user so don't know if you can do this on a Mac but try replacing the msgBox line with DoEvents
0
 

Author Closing Comment

by:Bryce Bassett
ID: 40307195
Brilliant!   DoEvents did the trick   After that I can manipulate newdeck.windows(1) as expected.  Thanks a million
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question