PPT2002: Exported Slides Not Sorted in Numerical Order in Windows Explorer (285520)



The information in this article applies to:

  • Microsoft PowerPoint 2002

This article was previously published under Q285520

SYMPTOMS

When you save a PowerPoint presentation in a graphic format such as GIF, JPEG, PNG or WMF, the graphic image files are not listed in order when viewed in Windows Explorer. The list of images will look like this when sorted by filename:

Slide1.jpg
Slide10.jpg
Slide11.jpg
...
slide19.jpg
slide2.jpg
slide20.jpg
...

CAUSE

This behavior occurs because the slides are saved with their slide index position at the end of the file name with no leading zeroes. The tenth slide image will be sorted after the first slide image, but before the second slide image.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
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: To work around this issue, follow these steps:
  1. Start PowerPoint and then open the file that you want to export.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor (or press ALT+F11).
  3. Type or paste the following code in the module:
Sub SortedPicts()
   Dim lSldCount As Long
   Dim lSlide As Long
   Dim lNumChars As Long
   Dim lPadZero As Long
   Dim strPath As String
   Dim strExportName As String
   
   '
   ' First get the number of slides in the presentation.
   ' Then count the number of digits in this number.
   ' For example: 12 has two digits.
   ' The Trim function is to remove any blank spaces
   ' in the converted number.
   '
   lSldCount = ActivePresentation.Slides.Count
   lNumChars = Len(Trim(Str(lSldCount)))
   '
   ' Get the path to where the presentation has been saved to.
   '
   strPath = ActivePresentation.Path
   '
   ' Loop through the presentation exporting out each slide
   ' as a JPEG image.
   '
   For lSlide = 1 To lSldCount
      lPadZero = Len(Trim(Str(lSlide)))
      lPadZero = lNumChars - lPadZero
   '
   ' The name is created using the path + "Slide" + "0"s to
   ' pad out to the left of the number + the current slide
   ' index position.
   '
      strExportName = strPath & "\" & "Slide" & _
         String(lPadZero, "0") & lSlide & ".jpg"
   '
   ' Export out the picture with the generated file name.
   '
      With Application.ActivePresentation.Slides(lSlide)
         .Export strExportName, "JPG"
      End With
   Next lSlide
End Sub

				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MinorLast Reviewed:9/27/2006
Keywords:kbbug kbpending KB285520