View Single Post
  #1   Report Post  
BizMark BizMark is offline
Member
 
Location: London
Posts: 78
Default Creating a Powerpoint object (in XP onwards) with an ActiveWindow

Hi guys - I'm new to this forum - I think I'm going to enjoy wading through the tips in here. I've been doing advanced Excel design and VBA programming since 1998 but haven't come across this site before.

Anyway - I have a problem.
When using Office 97 I wrote a suite of macros for my employer which was designed to write variable query strings to apply to imported data, which would then be squirted into user-defined chart areas, cycle each 'variable' variable (and all combinations thereof), copy the chart containing the data that matches, and paste into an output sheet as a metafile.

This was used to produce charts and tables for a survey whereby each participant needed a comparison of their data vs. everyone else EXCEPT theirs. This meant every table and chart in every copy of the report was unique.

I expanded this on user request to contain an option to throw out the metafiles to slides in a newly created Powerpoint file instead of just piling them up in an Excel worksheet, along with all its possible page setup/page break problems.

This worked great until I hit Office XP. The problem occurs when creating a Powerpoint Presentation object from VBA, because when it does so, the object contains an empty powerpoint window with task pane - i.e. there is no active 'presentation' window. For some reason it even seems impossible to 'Add' a presentation object to the application because there is no ActiveWindow.

Similarly, Powerpoint (along with Excel) doesn't allow you to 'add window' - i.e. you can't do Application.Windows.Add - you can only do ActiveWindow.NewWindow - i.e. you can add a window with reference to an existing window - but not if there is no existing window.

I've tried and tried and can just not start a Powerpoint XP object with a window to control the rest of the application and add presentations, slides etc. Even turning the Task Pane off doesn't help because the app object simply contains a blank window (which doesn't count as an ActiveWindow) reading 'Click here to create slide'. It is only when the user manually clicks on this area, that an ActiveWindow is then created.

How do I get past this so that I don't have to make the application visible and wait for the user to manually click in the centre of the screen to create an ActiveWindow? I want the process to remain transparent and interaction-free as it was pre-XP.

Many thanks to anyone who can help.

Best Regards,
Mark Boulton
London