自动COM错误打开PPT / PPTX

时间:2013-07-19 17:08:12

标签: com powerpoint autoit

当我尝试顶部打开PPT,而不是创建一个新的(工作正常!),我收到以下错误

$objPPT = _PPT_PowerPointApp()
If @error Then 
    MsgBox(0,"","No PowerPoint available") 
    Exit
EndIf
$PresInterface = _PPT_CreatePresentation($objPPT) ;Get presentation 
interface$objPres = _PPT_PresentationOpen($PresInterface,"C:\Users\s.mailappan\Desktop\3G-Reports\MyAutoItPresentation.ppt") ;Add a new presentation

COM Error while opening a PPT/PPTX

1 个答案:

答案 0 :(得分:0)

要打开现有的PPT,需要从原始代码中删除以下行。

$PresInterface = _PPT_CreatePresentation($objPPT) ;Get presentation 

使以下代码生效。

$objPPT = _PPT_PowerPointApp()
If @error Then 
    MsgBox(0,"","No PowerPoint available") 
    Exit
EndIf

$objPres = _PPT_PresentationOpen($objPPT,"C:\Users\s.mailappan\Desktop\3G-Reports\MyAutoItPresentation.ppt") ;Add a new presentation