Application.OpenThemeFile method (PowerPoint)
Opens the specified theme file (*thmx).
Syntax
expression. OpenThemeFile
(themeFileName)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
themeFileName | Required | String | The path of the theme file (*.thmx) to open. |
themeFileName | Required | String |
Return value
Example
This example opens a theme file, gets the ID of the third variant in the theme, and applies it to the first slide in the presentation.
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.Slides(1).ApplyTemplate2 path, variantID
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.