DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 253699 - Last Review: October 26, 2013 - Revision: 3.0

This article was previously published under Q253699
This article has been archived. It is offered "as is" and will no longer be updated.
For a Microsoft PowerPoint 2002 version of this article, see 291926  (http://support.microsoft.com/kb/291926/EN-US/ ) .

On This Page

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

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.
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"
   WebBrowser1.Navigate varURL
End Sub
				
To run this code, you have to add an action button to the slide to activate the macro:
  1. On the Drawing toolbar, click AutoShapes; point to Action Buttons, and click the Action Button: Custom button (the button that is blank).
  2. 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.
  3. Click Run Macro and then click the go2URL macro.

Automatically Load Web Page on Slide

The following procedure allows you to automatically load the URL when you display the slide on the screen:
  1. Right-click the WebBrowser control, and click View code on the shortcut menu.
  2. The Visual Basic Editor opens with the Slide n project selected, where n is the index value of the slide where you added the ActiveX control.
  3. In the Procedure list, click DocumentComplete.

    When you do this, Visual Basic for Applications automatically adds the following code into the slide:
    Sub <WebBrowserN>_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    
    End Sub
    						
    Where <WebBrowserN> represents the unique name of the WebBrowser control.
  4. Modify the subroutine above so that it looks as follows:
    Sub <WebBrowserN>_DocumentComplete(ByVal pDisp As Object, URL As Variant)
       Dim varURL As Variant
    
    ' Check to see if this is the first time this
    ' control has been run, if so, load the page.
       If URL = "" Then
          varURL = "http://www.microsoft.com"
          WebBrowser1.Navigate varURL
       End If
    End Sub
    					
  5. Close the Visual Basic Editor.

References

For more information about the Microsoft WebBrowser Control, click the following hyperlink
WebBrowser Control Reference for Visual Basic Developers (http://msdn2.microsoft.com/en-us/library/Aa752043.aspx)
which is on the Microsoft Developers Network (http://msdn.microsoft.com) .

For additional information about using the WebBrowser Control, click the article numbers below to view the articles in the Microsoft Knowledge Base:
176400  (http://support.microsoft.com/kb/176400/EN-US/ ) HOWTO: Print the WebBrowser Control
155969  (http://support.microsoft.com/kb/155969/EN-US/ ) HOWTO: Distribute the WebBrowser Control
174923  (http://support.microsoft.com/kb/174923/EN-US/ ) HOWTO: Use the PostData Parameter in WebBrowser Control

Applies to
  • Microsoft PowerPoint 2000 Standard Edition
Keywords: 
kbnosurvey kbarchive kbdtacode kbhowto KB253699
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support