Windows 7 - Unable to suppress PPT window

Asked By ToddWaldro on 04-Dec-07 12:25 AM
Hi all,

I've created an MS-Access application that uses COM Automation to update an
existing PPT template with data from an Excel file.  The problem I'm having
is the PPT is visible while it is being updated (while the automation
procedure is running).  I'd like to suppress/hide the PPT while it is being
updated so the UI of the MS-Access controller application will stay active
(my next step is to add a progress meter to the UI).

The beginning of the PPT portion of my automation has the following:

***Code Start***

Dim appPPT As PowerPoint.Application
Set appPPT = New PowerPoint.Application
appPPT.Visible = True

***Code End***

If I set [appPPT.Visible = False] I get:

Run-time error '-2147188160(80048240)':
Application (unknown member): Invalid request. Hiding the application window
is not allowed.

Is it possible to suppress/hide the PPT?

Thanks in advance.

Todd Waldron
Austin, Texas




john AT technologytrish.co DOT uk replied on 04-Dec-07 03:31 AM
Could you maybe set the PowerPoint window to minimise?
appPPT.Visible = True
appPPT.WindowState = 2

--
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
Chirag replied on 04-Dec-07 08:33 AM
You should not make the ppt window visible in the first place. Remove the
following line:

appPPT.Visible = True

from your code. Does that not work?

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
ToddWaldro replied on 04-Dec-07 09:41 AM
Hi Chirag,

When I remove the line [appPPT.Visible = True] it produces the following
error:

Run-time error '-2147188160 (80048240)':
Presentations (unknown member): Invalid Request.  The PowerPoint Frame
window does not exist.

John Wilson (mvp) suggested minimizing the PPT by adding:

appPPT.WindowState = 2

which works, but now my MS-Access window with the UI is not viewable.

Any other ideas?

Thank you,

Todd
Chirag replied on 04-Dec-07 10:03 AM
You would need to provide more code so that I can see the offending line.
Are you executing Select method?

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
ToddWaldro replied on 04-Dec-07 10:44 PM
Hi Chirag,

Here is the beginning of the code block where it fails:

***Code Start***

'Declare instance of MS-PowerPoint and it's objects
Dim appPPT As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
Dim pptSlide As PowerPoint.Slide
Dim pptShape As PowerPoint.Shape

Set appPPT = New PowerPoint.Application
appPPT.Visible = True

'Open the new PowerPoint presentation file
appPPT.Presentations.Open strTargetDirectory & "\" & strCompanyName
& ".ppt"

***Code End***

If I set [appPPT.Visible = False], it fails on the same line [appPPT.Visible
= False] with the error:

Run-time error '-2147188160(80048240)':
Application (unknown member): Invalid request. Hiding the application window
is not allowed.

If I comment out the line [appPPT.Visible] altogether if fails on the line
[appPPT.Presentations.Open strTargetDirectory & "\" & strCompanyName &

Run-time error '-2147188160 (80048240)':
Presentations (unknown member): Invalid Request.  The PowerPoint Frame
window does not exist.

Any ideas?

Thank you,

Todd
ToddWaldro replied on 04-Dec-07 10:51 PM
Hi John,

Thank you for your response.  Your suggestion to minimize the window works
great, but then the MS-Access user-interface window (MS-Access is the COM
controller) now becomes unviewable - it ghosts while the PPT update procedure
is running.  Any ideas?

Thank you,

Todd
Chirag replied on 05-Dec-07 08:06 AM
Change the line:

appPPT.Presentations.Open strTargetDirectory & "\" & strCompanyName
& ".ppt"

to:

appPPT.Presentations.Open strTargetDirectory & "\" & strCompanyName
& ".ppt", WithWindow:=False

That should get rid of that error. Basically, you want to tell PowerPoint to
not create any window for the presentation that you are opening. So,
PowerPoint does not insist on the main PowerPoint window.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
Nitin replied on 25-Jun-09 07:11 AM
You are required to be a member to post replies.  After logging in or becoming a member, you will be redirected back to this page.