如何以编程方式获取PowerPoint文件格式
-
04-10-2019 - |
题
我需要确定是否 ActivePresentation
为97-2003或2007年格式。我真的不想检查扩展名。
PowerPoint对象模型中的某个地方是否有一个属性?
解决方案
不幸的是,没有文件格式属性。您必须走延伸路线,例如:
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
不隶属于 StackOverflow