將設計範本與主題變體套用到簡報中。
語法
expression。
ApplyTemplate2
(檔案名稱,變體)
詞 一個代表 Presentation 物件的變數。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| FileName | 必要 | String | 會指定簡報設計範本的名稱。 |
| Variant | 必要 | 字串 | 指定適用的變體名稱。 |
| FileName | 必要 | 字串 | |
| Variant | 必要 | 字串 | |
| 變體GUID | 必要 | 字串 |
傳回值
虛
範例
這個範例會打開一個主題檔案,取得主題中第三個變體的 ID,並將其套用到呈現上。
Sub ChangeThemeVariant()
Dim name As String
Dim path As String
Dim variantID As String
' Get the name of the active theme family.
name = ActivePresentation.TemplateName
' You need access to the Theme Family in order to access the variants.
path = "C:\Program Files (x86)\Microsoft Office\Document Themes 15\" & _
ActivePresentation.TemplateName & ".thmx"
' Get the variant ID of the third Variant
' and apply that variant to the presentation.
variantID = PowerPoint.Application.OpenThemeFile(path).ThemeVariants(3).Id
ActivePresentation.ApplyTemplate2 path, variantID
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。