Método Application.OpenThemeFile (PowerPoint)

Abre el archivo de tema especificado (*thmx).

Sintaxis

expresión. OpenThemeFile(themeFileName)

expresión Variable que representa un objeto Application.

Parámetros

Nombre Obligatorio/opcional Tipo de datos Descripción
themeFileName Obligatorio String Ruta de acceso del archivo de tema (*.thmx) que se va a abrir.
themeFileName Obligatorio String

Valor devuelto

Theme

Ejemplo:

En este ejemplo se abre un archivo de tema, se obtiene el identificador de la tercera variante del tema y se aplica a la primera diapositiva de la presentación.

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

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.