Skip to content

Files

Latest commit

 

History

History
68 lines (43 loc) · 1.7 KB

PowerPoint.presentation.applytemplate2.md

File metadata and controls

68 lines (43 loc) · 1.7 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
Presentation.ApplyTemplate2 method (PowerPoint)
vbapp10.chm583124
vbapp10.chm583124
43d6d14a-078f-eefa-8ad5-981b0cb6ccb9
06/08/2017
medium

Presentation.ApplyTemplate2 method (PowerPoint)

Applies a design template and theme variant to the presentation.

Syntax

expression. ApplyTemplate2(FileName, Variant)

expression A variable that represents a Presentation object.

Parameters

Name Required/Optional Data type Description
FileName Required String Specifies the name of the design template.
Variant Required String Specifies the name of the variant to apply.
FileName Required String
Variant Required String
VariantGUID Required String

Return value

VOID

Example

This example opens a theme file, gets the ID of the third variant in the theme, and applies it to 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.ApplyTemplate2 path, variantID

End Sub

[!includeSupport and feedback]