Microsoft KB Archive/172440

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


Article ID: 172440

Article Last Modified on 10/11/2006



APPLIES TO

  • Microsoft PowerPoint 97 Viewer



This article was previously published under Q172440

SYMPTOMS

When you use the NewShow method (which is part of the Microsoft PowerPoint Viewer 97 object model) to start a slide show, the computer screen becomes black, and the show does not start. Pressing the ESC key does not close the show, so you must press ALT+TAB to switch to PowerPoint Viewer 97, and then click Exit. The first slide of the show appears, and then the show ends.

CAUSE

This problem occurs if PowerPoint Viewer is running when you obtain an object reference to it.

WORKAROUND

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. To work around this problem, use GetObject. If GetObject succeeds (obtains an object reference to PowerPoint Viewer), prompt the user to quit any instances of PowerPoint Viewer. When all instances of PowerPoint Viewer are terminated, use CreateObject to obtain an object reference. The following sample Visual Basic for Applications procedure demonstrates this technique.

    Sub StartShow()

      ' Change the path and file name to specify the presentation
      ' you want to open.
      Const PRESENTATION_NAME As String = "c:\test.ppt"

      ' Used for error trapping.
      On Error Resume Next
      Err.Clear

      ' Declare the variables used in the message box.
      Dim strPrompt As String
      Dim strTitle As String

      ' Declare a variable to store an object reference to PowerPoint
      ' Viewer.
      Dim oViewer As PowerPointViewer.Application

      ' Loop until GetObject fails. GetObject fails when no instances
      ' of PowerPoint Viewer are running.
      Do

         ' Attempt to get a reference to the PowerPoint Viewer
         ' object model. If PowerPoint Viewer is running, GetObject
         ' returns a reference.
         Set oViewer = GetObject(, "PowerPointViewer.Application.8")

         ' If GetObject succeeds, prompt to quit the PowerPoint Viewer.
         If Err.Number = 0 Then

            ' Set up the strings used in the message box.
            strPrompt = "Please quit all instances of Microsoft" _
               & " PowerPoint Viewer 97 " & vbCrLf & "and click retry."
            strTitle = "Quit Viewer 97"

            ' Display the message box.
            Dim lResult As Long
            lResult = MsgBox(strPrompt, vbRetryCancel + vbExclamation, _
               strTitle)

            ' If user clicked Cancel, end the procedure.
            If lResult = vbCancel Then
               Exit Sub
            End If

         End If

      Loop While Err.Number = 0

      ' Reset the Error object if needed.
      If Err.Number <> 0 Then
         Err.Clear
      End If

      ' Launch and get reference to PowerPoint Viewer.
      Set oViewer = CreateObject("PowerPointViewer.Application.8")

      ' Start a presentation in PowerPoint Viewer.
      oViewer.NewShow PRESENTATION_NAME, ppViewerSlideShowManualAdvance, _
         msoTrue

   End Sub
                

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

REFERENCES

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

163435 VBA: Programming Resources for Visual Basic for Applications



Additional query words: vba pptview32 vbe object model 8.00

Keywords: kbbug kbcode kbdtacode kbmacro kbpending kbprogramming KB172440