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?

More than 3 years have passed since last update.

【エクセルVBA】吹き出し:折れ線の終端を矢印にして追加する

Posted at

#エクセルのVBAで吹き出し(折れ線)の終端を矢印にして追加するマクロです。

##その他に以下について設定しています。
 ・塗りつぶしの色
 ・枠線の色・太さ・種類
 ・矢印の色・太さ・種類
 ・テキスト(フォント・大きさ・文字色)

Sub 吹き出し追加()
    Dim tshape As Shape
    
    Set tshape = ActiveSheet.Shapes.AddShape(msoShapeLineCallout3, 50, 50, 200, 30)
    
    With tshape
        ' 塗りつぶしの色
        tshape.Fill.ForeColor.RGB = RGB(255, 229, 214)
        ' 枠線の色
        tshape.Line.ForeColor.RGB = RGB(255, 0, 0)
        ' 枠線の太さ
        tshape.Line.Weight = 3
        ' 枠線の種類
        tshape.Line.Style = msoLineSingle '一重線
'        tshape.Line.Style = msoLineThinThin '細い二重線
'        tshape.Line.Style = msoLineThinThick '細い線と太い線の二重線。上が細い線で下が太い線
'        tshape.Line.Style = msoLineThickThin '太い線と細い線の二重線。上が太い線で下が細い線
'        tshape.Line.Style = msoLineThickBetweenThin '両側を細い線ではさまれた太い線
        ' 枠線の種類
        tshape.Line.DashStyle = msoLineSolid        '実線
'        tshape.Line.DashStyle = msoLineSquareDot    '点線 (角)
'        tshape.Line.DashStyle = msoLineRoundDot     '点線 (丸)
'        tshape.Line.DashStyle = msoLineDash         '破線
'        tshape.Line.DashStyle = msoLineDashDot      '一点鎖線
'        tshape.Line.DashStyle = msoLineDashDotDot   '二点鎖線
'        tshape.Line.DashStyle = msoLineLongDash     '長破線
'        tshape.Line.DashStyle = msoLineLongDashDot  '長鎖線
        ' 線の種類
'        tshape.Line.EndArrowheadStyle  = msoArrowheadNone  '矢印なし
        tshape.Line.EndArrowheadStyle = msoArrowheadTriangle   '三角矢印
'        tshape.Line.EndArrowheadStyle = msoArrowheadOpen   '開いた矢印
'        tshape.Line.EndArrowheadStyle = msoArrowheadStealth   '鋭い矢印
'        tshape.Line.EndArrowheadStyle = msoArrowheadDiamond   'ひし型
'        tshape.Line.EndArrowheadStyle = msoArrowheadOval   '円形矢印
        ' 矢印の長さ
'        tshape.Line.EndArrowheadLength   = msoArrowheadShort  '短い
'        tshape.Line.EndArrowheadLength   = msoArrowheadLengthMedium  '普通
        tshape.Line.EndArrowheadLength = msoArrowheadLong    '長い
        ' 矢印の幅
'        tshape.Line.EndArrowheadWidth    = msoArrowheadNarrow  '狭い
'        tshape.Line.EndArrowheadWidth    = msoArrowheadWidthMedium  '普通
        tshape.Line.EndArrowheadWidth = msoArrowheadWide     '広い
        ' テキスト
        tshape.TextFrame.Characters.Font.Size = 11    'サイズ11
        tshape.TextFrame.Characters.Font.Bold = True  '太字
        tshape.TextFrame.Characters.Font.Color = RGB(0, 0, 0)   '文字色:黒
        tshape.TextFrame2.TextRange.Font.NameFarEast = "BIZ UDゴシック" 'フォント
    End With
    Set tshape = Nothing
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?