等待 PowerPoint 导出到 MP4 完成

问题描述 投票:0回答:1

我正在使用 VBA 将 PowerPoint 演示文稿另存为 mp4 文件。我想在保存操作完成后关闭它。

我不知道如何确定这个动作何时完成。

ActivePresentation.SaveAs outFile, 39

Do  while  ????

ActivePresentation.close

Loop

我目前使用的解决方案是

wscript.sleep
,但这不是一个好主意。因为不同的 powerpoint 尺寸需要不同的时间来做这件事


ActivePresentation.SaveAs outFile, pptFormat

' save as MP4 need long time, do not close too early
If StrComp(Ucase( outFormat ),"MP4") = 0 then
    wscript.sleep 1000*60
End If
' Close the active document
ActivePresentation.Close
vba powerpoint
1个回答
0
投票

我认为 SaveAs 在完成保存文件之前不会返回。我希望这段代码能按你的意愿工作:

ActivePresentation.SaveAs outFile, ppSaveAsMP4
ActivePresentation.Close
© www.soinside.com 2019 - 2024. All rights reserved.