Embed WebBrowser control in PowerPoint and automate it

D

David J Boyd

I'm trying to add a 'WebBrowser' object to a slide in PowerPoint 2002 such
that it can be visible when that slide is shown, and can refresh its URL
using the Navigate2 method.

I started from a demo .ppt which contained a WebBrowser object. That demo
also has a button on the slide which calls the WebBrowser.Navigate2 method
within the button's OnClick event handler. This works, the URL loads and is
displayed.

But I'd like to have the browser activate and navigate based on something
more automatic, like each time the slide appears, or the slideshow starts.
Nothing I've tried so far works - I've tried to create a class module which
includes:

Public WithEvents App As Application
and then I've tried writing code in App_SlideShowBegin,
App_SlideShowNextSlide, etc.

If I manually run the code that instantiates the Application object, I can
get this to work - but only then. I've turned PowerPoint's security
settings down to low.

Can a VBA for PowerPoint guru suggest a way to get this to work? I would
very much appreciate it.

Thanks,

Dave
 
S

Steve Rindsberg

I'm trying to add a 'WebBrowser' object to a slide in PowerPoint 2002 such
that it can be visible when that slide is shown, and can refresh its URL
using the Navigate2 method.

I started from a demo .ppt which contained a WebBrowser object. That demo
also has a button on the slide which calls the WebBrowser.Navigate2 method
within the button's OnClick event handler. This works, the URL loads and is
displayed.

But I'd like to have the browser activate and navigate based on something
more automatic, like each time the slide appears, or the slideshow starts.
Nothing I've tried so far works - I've tried to create a class module which
includes:

Public WithEvents App As Application
and then I've tried writing code in App_SlideShowBegin,
App_SlideShowNextSlide, etc.

If I manually run the code that instantiates the Application object, I can
get this to work - but only then. I've turned PowerPoint's security
settings down to low.

You can fake it in a show situation:

Put up an intro slide that forces the user to click on something to continue.
Whatever they click on has an action setting that runs a macro.
The macro instantiates the object above, then advances to the next slide.

Your event handler takes care of the rest (you can trap the next slide event,
for example).

Or to make it even simpler, your navigation buttons can all trigger macros ...
for example, the Next button on each slide could:

Iterate through all the shapes on currentslide+1
If it finds a web control
Advance to the next slide
Refresh the web control
Else
Just advance
End if
 
D

David J Boyd

Steve,

Thanks for the tips.

Unfortunately, the show is really more of a kiosk-type presentation - there
is no chance of user interaction after the presentation starts. Well, at
least not unless it's launched within PP and started up; *then* there is no
subsequent user interaction.

I'm not clear on what makes this so hard - if the user allows macros to run
when the presentation loads, why can't a startup macro instantiate the
Application object? I'm really NOT a VBA programmer, nor even much of a PP
user, so if this question is absurd, please pardon my ignorance of the
subject. (I'd probably be more comfortable automating a PP container from,
say, LabVIEW. Consider this a bald-faced plea for some concrete example
code, sorry).

Best regards,

Dave
 
S

Steve Rindsberg

Unfortunately, the show is really more of a kiosk-type presentation - there
is no chance of user interaction after the presentation starts. Well, at
least not unless it's launched within PP and started up; *then* there is no
subsequent user interaction.

In that case, can we assume that you have control over the PC and can install
addins?

Have a look here and at the several FAQs below it:

Creating and Installing Add-ins, Toolbars, Buttons
http://www.rdpslides.com/pptfaq/index.html#Creating_and_Installing_Add-ins,_Too
lbars,_Buttons_
I'm not clear on what makes this so hard - if the user allows macros to run
when the presentation loads, why can't a startup macro instantiate the
Application object?

Macros don't run at startup or when a file is opened in PPT. It's totally
unlike Excel and Word in this respect. The only auto-run capability we have is
in Auto_Open macros in add-ins; these fire when the add-in loads, usually at
PPT startup.
I'm really NOT a VBA programmer, nor even much of a PP
user, so if this question is absurd, please pardon my ignorance of the
subject.

No problem. PPT's absurd said:
(I'd probably be more comfortable automating a PP container from,
say, LabVIEW. Consider this a bald-faced plea for some concrete example
code, sorry).

Check the examples at the site above; I think that should get you started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top