Método Presentation.ApplyTemplate2 (PowerPoint)

Aplica una plantilla de diseño y una variante de tema a la presentación.

Sintaxis

expresión. ApplyTemplate2(FileName,Variant)

Expresión Variable que representa un objeto Presentation .

Parameters

Nombre Obligatorio/opcional Tipo de datos Descripción
FileName Necesario String Especifica el nombre de la plantilla de diseño.
Variant Obligatorio String Especifica el nombre de la variante que se va a aplicar.
FileName Necesario String
Variant Obligatorio String
VariantGUID Obligatorio String

Valor devuelto

VACÍO

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 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.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.