Application.OpenThemeFile メソッド (PowerPoint)

指定したテーマ ファイル (*thmx) を開きます。

構文

OpenThemeFile(themeFileName)

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

パラメーター

名前 必須 / オプション データ型 説明
themeFileName 必須 String 開くテーマ ファイル (*.thmx) のパス。
themeFileName 必須 String

戻り値

Theme

次の使用例は、テーマ ファイルを開き、テーマ内の 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.Slides(1).ApplyTemplate2 path, variantID

End Sub

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。