ExcelVBAで個人的によく使う図形(赤枠、矩形、吹き出し)を一発で描画します。
実行環境
ソースコード
Option Explicit Sub 良く使う図形を描画する() ' 赤枠 ActiveSheet.Shapes.AddShape(msoShapeRectangle, 57.75, 23.25, 184.5, 90).Select Selection.ShapeRange.Fill.Visible = msoFalse With Selection.ShapeRange.Line .Visible = msoTrue .ForeColor.RGB = RGB(255, 0, 0) .Transparency = 0 .Weight = 3 End With ' 矩形 ActiveSheet.Shapes.AddShape(msoShapeRectangle, 65.25, 156, 181.5, 100.5).Select Selection.ShapeRange.ShapeStyle = msoShapeStylePreset1 With Selection.ShapeRange.TextFrame2.TextRange.Font .NameComplexScript = "Meiryo UI" .NameFarEast = "Meiryo UI" .Name = "Meiryo UI" End With ' 吹き出し ActiveSheet.Shapes.AddShape(msoShapeRectangularCallout, 66.75, 276.75, 192, _ 109.5).Select Selection.ShapeRange.ShapeStyle = msoShapeStylePreset1 With Selection.ShapeRange.TextFrame2.TextRange.Font .NameComplexScript = "Meiryo UI" .NameFarEast = "Meiryo UI" .Name = "Meiryo UI" End With End Sub
実行結果
「aaa」は手入力したものです。