Search code examples
vbams-officepowerpointoffice-interop

How to obtain PowerPoint File Format Programmatically


I need to determine whether the ActivePresentation is 97-2003 or 2007 format. I really won't want to check the extension.

Is there a property somewhere inside the PowerPoint Object Model which gives this info?


Solution

  • There is no File Format property, unfortunately. You'll have to go the extention route, like:

    Sub APFileFormat()
    Dim ap As Presentation
    Set ap = ActivePresentation
    Length = Len(ap.Name)
    Match = InStrRev(StringCheck:=ap.Name, StringMatch:=".")
    ExtentionLength = Length - Match
        Select Case ExtentionLength
            Case 4
                FileFormat = "PowerPoint 2007-2010"
            Case 3
                FileFormat = "PowerPoint 97-2003"
            Case Else
                FileFormat = "undetermined"
        End Select
    Debug.Print "The file format of the active presentation is " & FileFormat
    End Sub