How to use the WebBrowser control on a slide

For a Microsoft PowerPoint 2000 version of this article, see 253699 .

Summary

The code in this article demonstrates how to display a live Web page on a slide during a PowerPoint slide show, using the Microsoft WebBrowser ActiveX control.

More Information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. NOTE: The following macro examples work only in PowerPoint. Visual Basic for Applications macros are not supported by the Microsoft PowerPoint Viewer. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

Adding the Control

PowerPoint 2002 and PowerPoint 2003

To add a Microsoft WebBrowser control to a slide, follow these steps:

  1. Go to the slide where you want to insert the control.
  2. If the Control Toolbox is not already visible, point to Toolbars on the View menu, and then click Control Toolbox.
  3. Click the More Controls button in the Control Toolbox. Click Microsoft Web Browser, and then draw the control on your slide.

PowerPoint 2007

To add a Microsoft WebBrowser control to a slide, follow these steps:

  1. Click the Microsoft Office Button, and then click PowerPoint Options.
  2. Click Popular, click the Show Developer tab in the Ribbon check box, and then click OK.
  3. Locate the slide in which you want to insert the control.
  4. Click the Develop tab, and then click More Controls.
  5. Click Microsoft Web Browser, and then draw the control on your slide.
The Microsoft WebBrowser ActiveX control now appears on your slide.

Run from an Action Button

The following code runs the browser, opening the Uniform Resource Locator (URL) that you specify:
Sub go2URL ()
Dim varURL as Variant

varURL = "http://www.microsoft.com"
Slide1.WebBrowser1.Navigate varURL
End Sub
To run this code, you have to add an action button to the slide to activate the macro:

PowerPoint 2002 and PowerPoint 2003

  1. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  2. Paste the code into the Module1 window.
  3. Switch to the PowerPoint view.
  4. On the Drawing toolbar, click AutoShapes, point to Action Buttons, and click the Action Button: Custom button (the button that is blank).
  5. Draw the button in a suitable location on your slide.

    When you finish drawing the button, the Action Settings dialog box appears. The default action for this button is None.
  6. Click Run Macro, and then click the go2URL macro.

PowerPoint 2007

  1. Press ALT+F11 to start Visual Basic Editor.
  2. Paste the code into the Module1 window.
  3. Switch to the PowerPoint view.
  4. Click the Home tab, click More, and then click the Action Button: Custom button. This is the button that is blank.
  5. Draw the button in a suitable location on your slide.

    When you finish drawing the button, the Action Settings dialog box appears. The default action for this button is None.
  6. Click Run Macro, and then click the go2URL macro.

References

For more information about the Microsoft WebBrowser Control, visit the following Microsoft Web site:
For more information about using the WebBrowser Control, click the following article numbers to view the articles in the Microsoft Knowledge Base:

176400 How to print the WebBrowser control

155969 How to distribute the WebBrowser control

174923 How to use the PostData parameter in WebBrowser control

Propriedades

ID do Artigo: 291926 - Última Revisão: 13 de mai de 2007 - Revisão: 1

Comentários