通过VBA保存时禁用Powerpoint检查兼容性

时间:2017-09-25 18:29:41

标签: vba automation powerpoint-vba

我正在尝试自动化多个powerpoint文件,但是我有一个问题,当我在更新链接后尝试保存powerpoint文件时,它总是提示检查兼容框,(97-2003)有没有办法阻止这种情况发生,我知道你可以把它关掉,但我无法在Powerpoint找到一种方法。

我有下面的cose,它会加载文件,更新链接然后保存并创建一个pdf文件。

注意:我是通过Acess VBA运行的

Dim oPowerpoint As PowerPoint.Application
Dim pPreso As PowerPoint.Presentation 
Dim sPreso As String
Dim MyPath As String
Dim PDFName As String

sPreso = "C:\Test\Test - Presentation.ppt"
MyPath = "C:\Test\"
PDFName = "Test PDF"

Set oPowerpoint = CreateObject("Powerpoint.Application")
Set pPreso = oPowerpoint.Presentations.Open(sPreso, WithWindow:=msoFalse)
oPowerpoint.DisplayAlerts = False

pPreso.UpdateLinks

pPreso.Save

'Save As PDF Document
pPreso.ExportAsFixedFormat MyPath & PDFName & ".pdf", _
  ppFixedFormatTypePDF, ppFixedFormatIntentPrint, msoCTrue, 
 ppPrintHandoutHorizontalFirst, _
  ppPrintOutputSlides, msoFalse, , ppPrintAll, , False, False, False, False, 
False
  On Error GoTo 0

 pPreso.Close
 Set pPreso = Nothing
 oPowerpoint.Quit
 Set oPowerpoint = Nothing

0 个答案:

没有答案