VBA代码将PowerPoint文件转换为Window Media播放器文件

我想通过Excel VBA代码将PowerPoint文件(pptx)保存为Window Mediavideo(.wmv)。 可以通过VBA转换文件吗?

在Excel中,您可以创build一个过程如下:

Public Sub CreateVideo() Dim papp As PowerPoint.Application Dim p As PowerPoint.Presentation Set papp = CreateObject("Powerpoint.Application") Set p = papp.Presentations.Open("mypresentation.pptx") p.CreateVideo "myvideo.wmv" End Sub 

重要提示 :在VBA编辑器中,您需要select“选项” – > “参考” ; 在那里您需要检查“Microsoft Powerpoint 15.0 Object Library” 。 否则,它将无法正常工作。