2017-01-15 137 views
1

我有一个从指定位置打开PowerPoint文件的Excel宏。 PowerPoint文件是一个模板,但我需要宏来创建基于模板设计的新演示文稿,而不是打开模板本身。 我的代码将打开模板,而不是基于该模板的一个新的演示文稿,并为:在Excel中使用VBA使用PowerPoint模板创建新的PowerPoint演示文稿

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 

有谁知道我怎么能修改此让它创建基于模板的新演示文稿,而不是打开模板本身?

非常感谢提前。

科林

回答

1

在我看来,你应该打开设置为true与Untitled参数(Open方法)的模板文件。

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

Presentations.Open Method (PowerPoint)

打开该文件没有标题。这相当于创建文件的副本 。

+0

太棒了,非常感谢你! – Superhans

相关问题