PC Review


Reply
Thread Tools Rate Thread

powerpoint automation in "hidden/background" mode

 
 
=?Utf-8?B?bXN0dWVobGVy?=
Guest
Posts: n/a
 
      22nd Oct 2004
All,

I'm working on a vbscript application that uses Powerpoint Automation.

The app begins with the following code:

Dim oApp
Set oApp = CreateObject("Powerpoint.Application")
oApp.Visible = True

However, I was wondering if it was possible to use Powerpoint Automation
WITHOUT actually showing that to the user - I'd like to have Powerpoint do
the work INVISIBLY to the user.

I've tried this:

oApp.Visible = False

But then nothing seems to work. Is it possible to use Powerpoint Automation
in "background" or "hidden" mode?

Many thanks in advance!

Cheers,
Matt Stuehler


 
Reply With Quote
 
 
 
 
Tim Hards
Guest
Posts: n/a
 
      22nd Oct 2004
Hi Matt,
With PPT2003, I've just tested that I can do the following (in VB - you
might need to adapt it for VBScript):

Dim oApp As PowerPoint.Application
Set oApp = CreateObject("Powerpoint.Application")

Dim pres As PowerPoint.Presentation
Set pres = oApp.Presentations.Open("C:\\test.ppt", , , msoFalse)
MsgBox pres.Slides.Count

The key here is not setting the application window to be visible
(explicitly setting Visible = False caused an error for me), and opening
test.ppt with the WithWindow parameter set to false.

I suspect that some actions will require a window, but as you can see I
was at least able to access the slides collection and get a slide count.

Hope that helps.

--
Tim Hards
Chief Software Architect
Visual Exemplars Ltd

Perspector - 3D Business Graphics for PowerPoint
http://www.perspector.com/
 
Reply With Quote
 
Shyam Pillai
Guest
Posts: n/a
 
      23rd Oct 2004
Hi Matt,
Don't set the visible property to true and PowerPoint will continue the
session invisibly after it's been initialized. There are significant
performance improvements if you performing a lengthy task.
--
Regards
Shyam Pillai

Animation Carbon - http://www.mvps.org/skp/ac/index.html

"mstuehler" <(E-Mail Removed)> wrote in message
news:56C5A224-D7B9-46ED-B502-(E-Mail Removed)...
> All,
>
> I'm working on a vbscript application that uses Powerpoint Automation.
>
> The app begins with the following code:
>
> Dim oApp
> Set oApp = CreateObject("Powerpoint.Application")
> oApp.Visible = True
>
> However, I was wondering if it was possible to use Powerpoint Automation
> WITHOUT actually showing that to the user - I'd like to have Powerpoint do
> the work INVISIBLY to the user.
>
> I've tried this:
>
> oApp.Visible = False
>
> But then nothing seems to work. Is it possible to use Powerpoint
> Automation
> in "background" or "hidden" mode?
>
> Many thanks in advance!
>
> Cheers,
> Matt Stuehler
>
>



 
Reply With Quote
 
=?Utf-8?B?bXN0dWVobGVy?=
Guest
Posts: n/a
 
      23rd Oct 2004
Shyam,

Thank you for your response - performance improvements are exactly what I'm
after. However, I run into this problem:

Dim oApp
Set oApp = CreateObject("Powerpoint.Application")
Dim oPres
Set oPres = oApp.Presentations.Open("C:\Test.ppt")

When I run this, I immediately get this error:

"Presentations.Open : Invalid request. The Powerpoint Frame window does not
exist."

It seems that, if I run Powerpoint "invisibly", there are certain things you
cannot do - like open a .ppt file. Is this correct? What can you do, and not
do, when Powerpoint is "invisible?"

Many thanks in advance!

Cheers,
Matt


"Shyam Pillai" wrote:

> Hi Matt,
> Don't set the visible property to true and PowerPoint will continue the
> session invisibly after it's been initialized. There are significant
> performance improvements if you performing a lengthy task.
> --
> Regards
> Shyam Pillai
>
> Animation Carbon - http://www.mvps.org/skp/ac/index.html
>
> "mstuehler" <(E-Mail Removed)> wrote in message
> news:56C5A224-D7B9-46ED-B502-(E-Mail Removed)...
> > All,
> >
> > I'm working on a vbscript application that uses Powerpoint Automation.
> >
> > The app begins with the following code:
> >
> > Dim oApp
> > Set oApp = CreateObject("Powerpoint.Application")
> > oApp.Visible = True
> >
> > However, I was wondering if it was possible to use Powerpoint Automation
> > WITHOUT actually showing that to the user - I'd like to have Powerpoint do
> > the work INVISIBLY to the user.
> >
> > I've tried this:
> >
> > oApp.Visible = False
> >
> > But then nothing seems to work. Is it possible to use Powerpoint
> > Automation
> > in "background" or "hidden" mode?
> >
> > Many thanks in advance!
> >
> > Cheers,
> > Matt Stuehler
> >
> >

>
>
>

 
Reply With Quote
 
Shyam Pillai
Guest
Posts: n/a
 
      23rd Oct 2004
The last argument of the Open method is the WithWindow, set it to false and
then open the presentation. This will work just fine.


--
Regards
Shyam Pillai

Secure Pack: http://www.mvps.org/skp/securepack/

"mstuehler" <(E-Mail Removed)> wrote in message
news3B16557-F8FE-4641-A1E3-(E-Mail Removed)...
> Shyam,
>
> Thank you for your response - performance improvements are exactly what
> I'm
> after. However, I run into this problem:
>
> Dim oApp
> Set oApp = CreateObject("Powerpoint.Application")
> Dim oPres
> Set oPres = oApp.Presentations.Open("C:\Test.ppt")
>
> When I run this, I immediately get this error:
>
> "Presentations.Open : Invalid request. The Powerpoint Frame window does
> not
> exist."
>
> It seems that, if I run Powerpoint "invisibly", there are certain things
> you
> cannot do - like open a .ppt file. Is this correct? What can you do, and
> not
> do, when Powerpoint is "invisible?"
>
> Many thanks in advance!
>
> Cheers,
> Matt
>
>
> "Shyam Pillai" wrote:
>
>> Hi Matt,
>> Don't set the visible property to true and PowerPoint will continue the
>> session invisibly after it's been initialized. There are significant
>> performance improvements if you performing a lengthy task.
>> --
>> Regards
>> Shyam Pillai
>>
>> Animation Carbon - http://www.mvps.org/skp/ac/index.html
>>
>> "mstuehler" <(E-Mail Removed)> wrote in message
>> news:56C5A224-D7B9-46ED-B502-(E-Mail Removed)...
>> > All,
>> >
>> > I'm working on a vbscript application that uses Powerpoint Automation.
>> >
>> > The app begins with the following code:
>> >
>> > Dim oApp
>> > Set oApp = CreateObject("Powerpoint.Application")
>> > oApp.Visible = True
>> >
>> > However, I was wondering if it was possible to use Powerpoint
>> > Automation
>> > WITHOUT actually showing that to the user - I'd like to have Powerpoint
>> > do
>> > the work INVISIBLY to the user.
>> >
>> > I've tried this:
>> >
>> > oApp.Visible = False
>> >
>> > But then nothing seems to work. Is it possible to use Powerpoint
>> > Automation
>> > in "background" or "hidden" mode?
>> >
>> > Many thanks in advance!
>> >
>> > Cheers,
>> > Matt Stuehler
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?bXN0dWVobGVy?=
Guest
Posts: n/a
 
      25th Oct 2004
Shyam,

Your solution works perfectly. Thank you very much for your expertise.

I've noticed one strange problem though...

When I use vba/vbscript to add content to powerpoint tables, and Powerpoint
is in "visible" mode, then the table cells resize automatically to fit the
content - this is the desired behavior.

When I run the vba/vbscript in Powerpoint in "hidden" mode, however, the
table cells don't resize as they should.

Is there some command that tells tables to resize to fit the content that
works when Powerpoint is in hidden mode?

Many, many thanks in advance!

Cheers,
Matt Stuehler

"Shyam Pillai" wrote:

> The last argument of the Open method is the WithWindow, set it to false and
> then open the presentation. This will work just fine.
>
>
> --
> Regards
> Shyam Pillai
>
> Secure Pack: http://www.mvps.org/skp/securepack/
>
> "mstuehler" <(E-Mail Removed)> wrote in message
> news3B16557-F8FE-4641-A1E3-(E-Mail Removed)...
> > Shyam,
> >
> > Thank you for your response - performance improvements are exactly what
> > I'm
> > after. However, I run into this problem:
> >
> > Dim oApp
> > Set oApp = CreateObject("Powerpoint.Application")
> > Dim oPres
> > Set oPres = oApp.Presentations.Open("C:\Test.ppt")
> >
> > When I run this, I immediately get this error:
> >
> > "Presentations.Open : Invalid request. The Powerpoint Frame window does
> > not
> > exist."
> >
> > It seems that, if I run Powerpoint "invisibly", there are certain things
> > you
> > cannot do - like open a .ppt file. Is this correct? What can you do, and
> > not
> > do, when Powerpoint is "invisible?"
> >
> > Many thanks in advance!
> >
> > Cheers,
> > Matt
> >
> >
> > "Shyam Pillai" wrote:
> >
> >> Hi Matt,
> >> Don't set the visible property to true and PowerPoint will continue the
> >> session invisibly after it's been initialized. There are significant
> >> performance improvements if you performing a lengthy task.
> >> --
> >> Regards
> >> Shyam Pillai
> >>
> >> Animation Carbon - http://www.mvps.org/skp/ac/index.html
> >>
> >> "mstuehler" <(E-Mail Removed)> wrote in message
> >> news:56C5A224-D7B9-46ED-B502-(E-Mail Removed)...
> >> > All,
> >> >
> >> > I'm working on a vbscript application that uses Powerpoint Automation.
> >> >
> >> > The app begins with the following code:
> >> >
> >> > Dim oApp
> >> > Set oApp = CreateObject("Powerpoint.Application")
> >> > oApp.Visible = True
> >> >
> >> > However, I was wondering if it was possible to use Powerpoint
> >> > Automation
> >> > WITHOUT actually showing that to the user - I'd like to have Powerpoint
> >> > do
> >> > the work INVISIBLY to the user.
> >> >
> >> > I've tried this:
> >> >
> >> > oApp.Visible = False
> >> >
> >> > But then nothing seems to work. Is it possible to use Powerpoint
> >> > Automation
> >> > in "background" or "hidden" mode?
> >> >
> >> > Many thanks in advance!
> >> >
> >> > Cheers,
> >> > Matt Stuehler
> >> >
> >> >
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Word 2007: adjust background in "print layout" mode Tony O Microsoft Word Document Management 0 26th May 2011 07:38 PM
PowerPoint automation "Run-time error '0'" RAHUL Microsoft Powerpoint 0 9th Dec 2009 05:49 AM
Opening Tables and/or Reports in "hidden" mode waynemb Microsoft Access VBA Modules 4 14th Dec 2007 09:22 PM
Running a timer in "background" or in standby mode johnnygoodface Microsoft Dot NET Compact Framework 0 3rd Mar 2007 12:34 AM
"Page" mode displays with a black background ! =?Utf-8?B?Z3JlZ2xlZw==?= Microsoft Frontpage 0 23rd Oct 2004 04:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:34 AM.