How can I check ActivePresentation File type and show it with msgbox?
I know how to do this in Word and Excel-
Word: msgbox activedocument.SaveFormat
Excel: msgbox ActiveWorkbook.FileFormat
Thanks
How can I check ActivePresentation File type and show it with msgbox?
I know how to do this in Word and Excel-
Word: msgbox activedocument.SaveFormat
Excel: msgbox ActiveWorkbook.FileFormat
Thanks
I don't think there's any equivalent FileFormat/SaveFormat property in PowerPoint, so you'll probably need to look at the file's extension.
Something like this:
Option Explicit
Sub Test()
MsgBox FileType(ActivePresentation.Name)
End Sub
Function FileType(sName As String) As String
Dim sMsg As String
Dim sExt As String
If InStr(sName, ".") = 0 Then
sMsg = "File hasn't been saved, so type is unknown."
Else
sExt = Mid$(sName, InStrRev(sName, ".") + 1)
Select Case UCase(sExt)
Case Is = "PPT"
sMsg = "Powerpoint 2003 or earlier"
Case Is = "PPTX"
sMsg = "Powerpoint 2007 or later"
Case Is = "PPTM"
sMsg = "Powerpoint 2007 or later, with macros"
Case Is = "PPS"
sMsg = "Powerpoint 2003 or earlier SHOW file"
Case Is = "PPSX"
sMsg = "Powerpoint 2007 or later SHOW file"
Case Is = "PPSM"
sMsg = "Powerpoint 2007 or later SHOW file with macros"
' Add more case statements as needed
Case Else
sMsg = "Unknown file type (" & sExt & ")"
End Select
End If
FileType = sMsg
End Function