Presentation.ApplyTemplate2 メソッド (PowerPoint)

デザイン テンプレートとテーマバリアントをプレゼンテーションに適用します。

構文

ApplyTemplate2(FileName,Variant)

Presentation オブジェクトを表す変数。

パラメーター

名前 必須 / オプション データ型 説明
FileName 必須 String デザイン テンプレートの名前を指定します。
バリアント型 必須 String 適用するバリアントの名前を指定します。
FileName 必須 String
バリアント型 必須 String
VariantGUID 必須 String

戻り値

VOID

次の使用例は、テーマ ファイルを開き、テーマ内の 3 番目のバリアントの 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 のサポートおよびフィードバックを参照してください。