シートに挿入されている画像をオブジェクト変数にSetする方法の記録です。
< スポンサーリンク >
例
インデックス番号「1」の画像をオブジェクト変数にSetし、画像の名前をメッセージで表示する。
Sub test()
Dim shp As Shape
Set shp = ActiveSheet.Shapes(1)
MsgBox shp.Name
End Sub
画像の名前「Picture 1」でオブジェクト変数にSetし、画像の名前をメッセージで表示する。
Sub test()
Dim shp As Shape
Set shp = ActiveSheet.Shapes(“Picture 1”)
MsgBox shp.Name
End Sub
シートの全ての画像を1つずつSetして、名前をメッセージで表示する。
Sub test()
Dim shp As Shape
Dim cnt As Long
cnt = 1
For Each shp In ActiveSheet.Shapes
Set shp = ActiveSheet.Shapes(cnt)
MsgBox shp.Name
cnt = cnt + 1
Next shp
End Sub
こんな記事も書いています