我正在使用 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
我认为 SaveAs 在完成保存文件之前不会返回。我希望这段代码能按你的意愿工作:
ActivePresentation.SaveAs outFile, ppSaveAsMP4
ActivePresentation.Close