簡體   English   中英

在 Excel 中使用 VBA 從 PowerPoint 模板創建新的 PowerPoint 演示文稿

[英]Create new PowerPoint presentation from PowerPoint template using VBA in Excel

我有一個 Excel 宏,可以從指定位置打開 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

在我看來,您應該打開模板文件,並將Untitled參數( Open方法)設置為 true。

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

根據Presentations.Open Method (PowerPoint)

打開沒有標題的文件。 這相當於創建文件的副本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM