excel - 如何在 Excel VBA 中打开“带有新的 PPT 文件”选项
问题描述
我有以下代码来打开 ppt 文件,但我需要使用新选项打开该文件(参考图片)。这样现有的文件就不会在不知不觉中受到干扰。请提供任何帮助。
Sub openfile()
Dim objPP As Object
Dim objPPFile As Object
Set objPP = CreateObject("PowerPoint.Application")
objPP.Visible = True
Set objPPFile = objPP.Presentations.Open("E:\Test\Tempplate.pptx")
End Sub
解决方案
Sub openfile()
Dim objPP As Object
Dim objPPFile As Object
Set objPP = CreateObject("PowerPoint.Application")
objPP.Visible = True
ts = Format(Now(), "MMDDYYYY_HHMM")
fn = "E:\Test\New_" & Trim(ts) & ".pptx"
FileCopy "E:\Test\Tempplate.pptx", fn
Set objPPFile = objPP.Presentations.Open(fn)
End Sub
推荐阅读
- python - 如何将 .cer 文件(我拥有的数字签名证书)添加到 pdf?
- c++ - 为 postgresql 编译 libpqxx C++ 库时找不到 libpq-fe.h
- machine-learning - 我可以同时在测试和训练数据上使用 CountVectorizer 还是需要将其拆分?
- c - c:通过引用传递双首指针保持为0
- php - 为什么没有 echo $e->getMessage(); 打印错误信息
- machine-learning - 评估 AutoKeras 模型给出不同的结果,然后与纯 Keras 评估相同的模型(h5 文件)
- bash - Bash:由“文本在找到匹配的引号之前结束”引起的“无法解析参数”
- html - 具有高度的 flexbox:100% 不适用于 chrome 72+
- python - 关于 tf.layers .dense 的问题
- c# - Windows 服务对运行 .exe 文件的限制