PPT2000: Slide.Export Method Causes Error When Exporting as Graphics (279238)



The information in this article applies to:

  • Microsoft PowerPoint 2000

This article was previously published under Q279238

SYMPTOMS

When you use the Export method of the Slide object, you may receive the following error message:
Run time error '-2147467259 (80004005)'
Slide (unknown member): MSO9.dll error

CAUSE

This error message occurs when the slide contains a damaged or corrupted object.

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.
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:

Sample Code for Picture Export

To work around this problem, use the Export method of the Presentation object. The following sample code allows you to control the file name of each graphic.

NOTE: The following sample code requires that you install the Microsoft Windows Scripting Host software before you attempt to run this code. For additional information about the Windows Scripting Host and where to get it, click the article number below to view the article in the Microsoft Knowledge Base:

259103 HOWTO: Use the Windows Scripting Host to Automate an Application

  1. Create a blank presentation in PowerPoint.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  3. On the Tools menu, click References.
  4. In the list of references, click to select the Microsoft Scripting Runtime check box. Click OK.
  5. On the Insert menu, click Module.
  6. Type the following code in the module:
    Sub ExportImage()
    '
    ' Declare as a string constant which drive path
    ' you want to export the graphics to.
    ' By doing it this way, it is simple to alter the
    ' the location that you will save to.
    '
       Const strDrivePath As String = "C:\your_folder"
       Dim fsoFile As Scripting.FileSystemObject
       Dim oSlidesCount As Long
       Dim i As Long
       Dim strPadZero As String
    '
    ' Set fsoFile to Scripting's FileSystemObject.
    '
       Set fsoFile = CreateObject("Scripting.FileSystemObject")
    '
    ' Get the number of slides in the presentation.
    '
       oSlidesCount = ActivePresentation.Slides.Count
    '
    ' Using Presentation object's Export method, export the
    ' slides to the folder location of your choice.
    '
       ActivePresentation.Export strDrivePath, "JPG"
    '
    ' After the slides have been exported as graphics, use the
    ' FileSystemObject to rename the images to a name of your own
    ' choosing.
    '
       For i = 1 To oSlidesCount
    '
    ' Put leading zeros in front of the current index value if
    ' i is less than 1,000. This ensures that the images will be
    ' sorted in proper numerical order when sorted by name.
    '
          If i < 1000 Then
             strPadZero = Format(i, "000")
          Else
             strPadZero = i
          End If
    '
    ' Using the MoveFile method, rename the slide JPEGs to a name of
    ' your own choosing. In this example, they are being named:
    '    myslide_00#.jpg
    '
          fsoFile.MoveFile strDrivePath & "\SLIDE" & i & ".JPG", _
                strDrivePath & "\myslide_" & strPadZero & ".jpg"
       Next i
    
    End Sub
    					
  7. Close the Visual Basic Editor, and then save the presentation.
  8. Open the presentation that you cannot export to a graphic format when you use the Export method of the Slide object.
  9. On the Tools menu, point to Macro, and then click Macros.
  10. In the Macro in list, click All open presentations.
  11. Click ExportImage in the macro list, and then click Run.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Office XP.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kbdtacode kberrmsg kbfix KB279238