「Excel VBA」複数の吹き出しの文字を置換する

2022年1月12日

環境
Windows 10 64bit
Excel 2013
シート名 arkgame
一つ目吹き出し:Shapes(1)
2つ目吹き出し:Shapes(2)
3つ目吹き出し:Shapes(3)

書式
With ActiveSheet
For i=開始値 To .Shapes.Count
処理コード

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Sub FunA()
Dim i As Integer
'シート名arkgame
Sheets("arkgame").Select
With ActiveSheet
For i = 1 To .Shapes.Count
'シートの吹き出しの文字を置換
With .Shapes(i).TextFrame
'置換文字
.Characters.Text = "Test Case111"
'幅広く
.AutoSize = True
End With
Next
End With
End Sub
Sub FunA() Dim i As Integer 'シート名arkgame Sheets("arkgame").Select With ActiveSheet For i = 1 To .Shapes.Count 'シートの吹き出しの文字を置換 With .Shapes(i).TextFrame '置換文字 .Characters.Text = "Test Case111" '幅広く .AutoSize = True End With Next End With End Sub
Sub FunA()
    Dim i As Integer
    'シート名arkgame
    Sheets("arkgame").Select

    With ActiveSheet
        For i = 1 To .Shapes.Count
        'シートの吹き出しの文字を置換
            With .Shapes(i).TextFrame
            '置換文字
                .Characters.Text = "Test Case111"
                '幅広く
                .AutoSize = True
            End With
        Next
    End With
End Sub

 

Excel VBA

Posted by arkgame