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?
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?
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
When the presentation is open there is no file format, its all in memory. However the file it came from can be in either the older binary format or the newer OpenXML format. The easiest way to tell the difference is to look at the first few bytes of the file.
For the binary formats it is an OLE Compound File which will always start with the bytes: 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1.
For the newer formats it is a ZIP file which will always start with the bytes: 0x50, 0x4B, 0x03, 0x04
Looking at the first few bytes of the file is the best way to quickly determine the file type, though it takes more work.