0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

高橋メソッドで100枚スライドを作った後で、全テキストの文字色を一括変換したくなって作ったVBAマクロ

0
Last updated at Posted at 2026-04-27

はじめに

高橋メソッドという、1スライド1メッセージで表現するプレゼンテーションテクニックがあります。このテクニックではスライド枚数が必然的に多くなります。

久しぶりに高橋メソッドでスライドを作ろうと100枚ほど用意した後で、真っ黒のフォントが100枚続くと目がちかちかするので、グレーの文字色にトーンを落としたくなりました。

が、後の祭りでした。本来は、スライドマスターでテキストボックスだけのレイアウトを作り、そのレイアウトのスライドを挿入していけばよかったんです。
でも私は、真っ白なスライドにテキストボックスを貼り付け、そのスライドをコピペで大量製造して、メッセージを書き込んでいました。

こうしてしまうと、複数テキストボックスの文字色を一括変換する機能は、PowerPointで提供されていないため、手作業地獄を要求されることになります。

対策: VBAマクロによる一括変換

結果、VBAのマクロを作って一括変換しました。
…まぁ、正直に言うと、Claudeに作ってもらいました。

手順

  1. Alt + F11 でVBAエディタを起動
  2. メニューから 挿入標準モジュール を選択
  3. 以下のコードを貼り付け
  4. RGB(0, 0, 255) の部分を好きな色に変更する(今回、私の場合は RGB(58, 58, 58)
  5. F5 で実行

コード

Sub ChangeAllTextFontColor()
    Dim sld As Slide
    Dim shp As Shape
    Dim newColor As Long

    ' 変更後の色(RGB値)ここでは青
    newColor = RGB(0, 0, 255)

    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            If shp.HasTextFrame Then
                If shp.TextFrame.HasText Then
                    shp.TextFrame.TextRange.Font.Color.RGB = newColor
                End If
            End If
        Next shp
    Next sld

    MsgBox "変更完了"
End Sub

応用パターン

1. テキストボックスだけを対象にしたい(プレースホルダーや表は除外)

Shape.Type で絞り込みます。

For Each shp In sld.Shapes
    If shp.Type = msoTextBox Then
        If shp.HasTextFrame Then
            If shp.TextFrame.HasText Then
                shp.TextFrame.TextRange.Font.Color.RGB = newColor
            End If
        End If
    End If
Next shp

2. 特定の色だけ別の色に置換したい

「黒い文字だけを赤に変える」といった使い方です。

Dim fromColor As Long, toColor As Long
fromColor = RGB(0, 0, 0)     ' 変更前: 黒
toColor = RGB(255, 0, 0)     ' 変更後: 赤

For Each sld In ActivePresentation.Slides
    For Each shp In sld.Shapes
        If shp.HasTextFrame Then
            If shp.TextFrame.HasText Then
                If shp.TextFrame.TextRange.Font.Color.RGB = fromColor Then
                    shp.TextFrame.TextRange.Font.Color.RGB = toColor
                End If
            End If
        End If
    Next shp
Next sld

注意点

  • 実行前に必ずバックアップを取る(マクロによる変更は Ctrl + Z で戻せないことがある)
  • マクロを含むファイルを保存するときは .pptm(マクロ有効プレゼンテーション)で保存する必要がある(一時的に使うだけなら保存せずに閉じてもよい)

まとめ

  • PowerPointには複数テキストボックスの文字色を一括変換する機能がない
  • スライドマスターを最初から使うのが本筋ではあるが、後からでもVBAで救済できる
  • VBAマクロで全スライド・全シェイプを走査すれば瞬時に完了する
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?