在Excel中使用VBA从PowerPoint模板创建新的PowerPoint演示文稿 [英] Create new powerpoint presentation from powerpoint template using VBA in Excel

查看:648
本文介绍了在Excel中使用VBA从PowerPoint模板创建新的PowerPoint演示文稿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel宏,可以从指定位置打开PowerPoint文件. PowerPoint文件是一个模板,但是我需要宏来基于模板设计创建一个新的演示文稿,而不是打开模板本身. 我的代码将打开模板,而不是基于该模板的新演示文稿,如下所示:

I have an excel macro that opens a powerpoint file from a specified location. The powerpoint file is a template but i need the macro to create a new presentation based on the template design rather than open the template itself. My code will open the template rather than a new presentation based on that template and is as follows:

   Sub Open_PowerPoint_Presentation()
'Opens a PowerPoint Document from Excel

Dim objPPT As Object

Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True

'Change the directory path and file name to the location
'of your document

objPPT.Presentations.Open "C:\Users\Colin\Documents\Custom Office Templates\PowerPoint Templates\Edge45 Monthly Report Template Macro.potm"

End Sub

有人知道我该如何修改它以使其基于模板而不是打开模板本身来创建新的演示文稿?

Does anyone know how I can modify this to make it create the new presentation based on template rather than open the template itself?

非常感谢.

科林

推荐答案

我认为,您应该将Untitled参数(Open方法)设置为true,以打开模板文件.

In my opinion, you should open your template file with the Untitled parameter (Open method) set to true.

objPPT.Presentations.Open FileName:="MyTemplate Macro.potm", Untitled:=msoTrue

根据 Presentations.Open方法(PowerPoint)

打开不带标题的文件.这等效于创建副本 文件.

Opens the file without a title. This is equivalent to creating a copy of the file.

这篇关于在Excel中使用VBA从PowerPoint模板创建新的PowerPoint演示文稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆