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?

uk

Posted at
Sub ReplaceFontInSlides()
    Dim slide As slide
    Dim shape As shape
    Dim textRange As TextRange
    Dim paragraph As TextRange
    Dim run As TextRange
    
    Dim oldFont As String
    Dim newFont As String
    
    ' 置き換えるフォント名を指定
    oldFont = "Noto Sans Symbols"
    newFont = "MS Pゴシック"
    
    ' すべてのスライドをループ
    For Each slide In ActivePresentation.Slides
        ' スライド内のすべてのシェイプをループ
        For Each shape In slide.Shapes
            ' テキストを含むシェイプのみ処理
            If shape.HasTextFrame Then
                If shape.TextFrame.HasText Then
                    Set textRange = shape.TextFrame.TextRange
                    
                    ' テキスト内のすべての段落をループ
                    For Each paragraph In textRange.Paragraphs
                        ' 段落内の各テキストラン(文字の連続)をループ
                        For Each run In paragraph.Runs
                            ' 指定したフォントが適用されているか確認
                            If run.Font.Name = oldFont Then
                                ' フォントを新しいフォントに変更
                                run.Font.Name = newFont
                            End If
                        Next run
                    Next paragraph
                End If
            End If
        Next shape
    Next slide
    
    MsgBox "フォントの置換が完了しました!", vbInformation
End Sub

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?