Microsoft KB Archive/265385

= INFO: Automation of PowerPoint 97 and PowerPoint 2000 Viewers =

Article ID: 265385

Article Last Modified on 4/4/2006

-

APPLIES TO


 * Microsoft PowerPoint 97 Standard Edition
 * Microsoft PowerPoint 2000 Standard Edition

-



This article was previously published under Q265385



SUMMARY
The Microsoft PowerPoint 97 and 2000 Viewers support a limited Automation model that developers can use to programmatically start a slide show. This article provides general information about using Automation to control the PowerPoint Viewer, and details some of the known problems and restrictions when using the viewer.



MORE INFORMATION
To automate the PowerPoint Viewer on a client system, the viewer must be installed and run at least once to properly register the application as an Automation server. To download and install the viewer, clients can go to the following Microsoft Web site and obtain a copy of the PowerPoint Viewer:

Microsoft Office Converters and Viewers

http://www.microsoft.com/office/000/viewers.htm

To automate the viewer and start a slide show, you create an instance of the PowerPointViewer.Application object, and then call the NewShow method, passing a path to the presentation file to start. For example, you could use the following Visual Basic code to start and then stop a new presentation in the viewer: Private Sub Command1_Click ' Set a reference to the Microsoft PowerPointViewer 8.0 Object Library ' (msppt8vr.olb) from the Project|References dialog. Dim oPPTViewer As PowerPointViewer.Application Dim oPPTShow As PowerPointViewer.SlideShowView Dim sPPTFile As String ' Choose a PowerPoint file to open... sPPTFile = &quot;C:\DsTest.ppt&quot; ' Start an instance of the viewer. This may fail if the viewer is ' already running. You can use GetObject to get the running viewer, ' however you cannot open a new slide show if another show is in ' progress. So, if this fails, we can't continue. Set oPPTViewer = CreateObject(&quot;PowerPointViewer.Application&quot;) ' Start the show and get a SlideShowView object... Set oPPTShow = oPPTViewer.NewShow(sPPTFile, _                      ppViewerSlideShowManualAdvance, True) ' Display the number of slides in this view... MsgBox &quot;Slides in this show = &quot; & Str(oPPTShow.SlidesCount), _ vbMsgBoxSetForeground ' Exit the slide show and quit (just to demo you can do this)... oPPTShow.Exit Set oPPTShow = Nothing oPPTViewer.Quit Set oPPTViewer = Nothing End Sub Automation clients should be aware that the type library for the PowerPoint Viewer contains an internal reference to the Microsoft Office 8.0 Object Library, which typically is not available unless Office 97, Office 2000 (mso97.dll/mso9.dll), or the Office run-time file (mso97rt.dll) is installed on the system. Because of this dependency, Automation clients may get the one of the following run-time error messages on a call to CreateObject, CreateDispatch, or CoCreateInstance objects:

Run-time error '48': Error loading DLL.

-or-

0x80029C4A (TYPE_E_CANTLOADLIBRARY): Error loading type library/DLL.

In order to resolve this error message, at least one Office-compatible application needs to be installed on the system. Besides any Office 97or Office 2000 application, this would include the Microsoft Access 97 or Microsoft Access 2000 run-time, Microsoft Visual Studio, Microsoft Works, and the freely available Microsoft ActiveX Control Pad located at the following Microsoft Web site:

(http://msdn.microsoft.com/workshop/misc/cpad/)

If you want to run the PowerPoint Viewer from a CD-ROM, you cannot use Automation to start the viewer. Automation requires the viewer to be properly installed and run once (for registration) before you can have COM create a new instance. For additional information on using the PowerPoint Viewer from a CD-ROM, click the article number below to view the article in the Microsoft Knowledge Base:

241493 PPT2000: How to Distribute Presentations on CD-ROM

Instead of Automation, developers may choose to shell a PowerPoint file (*.ppt) to start a slide show and let it run. In addition, the PowerPoint viewer supports the use of a list file (*.lst) to allow for the playing of multiple presentations, one right after the other. For additional information about using a list file, click the article number below to view the article in the Microsoft Knowledge Base:

190091 PPT97: How to Write and Use a List File in PowerPoint Viewer

When viewing a presentation in the viewer, developers should take into consideration that there are other limitations that could affect their design, such as:
 * not being able to run Visual Basic for Applications (VBA) macros in the presentation
 * not being able to use hyperlinks with grouped objects
 * not playing animated Graphics Interface Format (.gif) files

For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

238366 PPT2000: Animated GIF Images Don't Work in the Viewer

172440 PPT97: NewShow Method Doesn't Start Slide Show If Viewer Running

172369 PPT97: Viewer Quit Method Does Not Close Viewer

