1
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?

More than 1 year has passed since last update.

VBA 図形のうち画像にのみ枠線をつけるマクロ

Last updated at Posted at 2022-03-01

テスト証跡を作成する際、キャプチャした画像をExcelに貼り付けるのですが、枠線がなくて見づらいことがあります。毎回手動で枠線を設定するのが面倒なのでマクロを作りました。

Public Sub アクティブブックの画像すべてに枠線をつける()
    Dim ws As Worksheet
    Dim shp As Shape
    
    For Each ws In Worksheets  '全シートループ
        For Each shp In ws.Shapes  '全図形ループ
            If shp.Type = msoPicture Then  '図形タイプが画像のもののみ処理
                shp.Line.ForeColor.SchemeColor = vbBlack  '枠線の色
                shp.Line.Weight = 0.5  '枠線の太さ
                shp.Line.Style = msoLineSingle 
                shp.Line.DashStyle = msoLineSolid
            End If
        Next
    Next
End Sub
1
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
1
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?