【Word VBA】朝顔描画マクロ▽ソースコード

記事
IT・テクノロジー
HC220714A.png

Option Explicit
Option Base 0
Public Sub 朝顔描画マクロ()
    Const MOGLLEFT = 80    '描画開始位置X
    Const MOGLTOPP = 70     '      Y  
    '
    Const MOGLSIZE = 36      'サイズ
    Const MOGLVSPC = 50     '垂直間隔
    Const MOGLHSPC = 50     '水平間隔
    '
    Const MOGLCOLS = 6       '横描画数
    Const MOGLROWS = 4     '縦描画数
    '---------------------------------------------------------------------------
    Dim Ip As Integer, Jp As Integer
    Dim intDxp As Integer, intDyp As Integer
    Dim lngCol(4) As Long
    '
    lngCol(0) = RGB(30, 144, 255): lngCol(1) = RGB(255, 20, 147)
    lngCol(2) = RGB(138, 43, 226): lngCol(3) = RGB(100, 149, 237)
    lngCol(4) = RGB(221, 160, 221)
    For Jp = 0 To MOGLROWS - 1
        intDyp = MOGLTOPP + MOGLHSPC * Jp
        For Ip = 0 To MOGLCOLS - 1
            intDxp = MOGLLEFT + MOGLVSPC * Ip
            With ActiveDocument.Shapes.AddShape(msoShapeOval, _
                                intDxp, intDyp, MOGLSIZE, MOGLSIZE)
                .Fill.ForeColor.RGB = lngCol((Jp * MOGLCOLS + Ip) Mod 5)
                .Line.ForeColor.RGB = vbBlack
            End With
            With ActiveDocument.Shapes.AddShape(msoShape7pointStar, _
                                intDxp, intDyp, MOGLSIZE, MOGLSIZE)
                .Fill.ForeColor.RGB = vbWhite
                .Line.Visible = False
                .Adjustments(1) = 0.1
           End With
        Next Ip
    Next Jp
End Sub

サービス数40万件のスキルマーケット、あなたにぴったりのサービスを探す ココナラコンテンツマーケット ノウハウ記事・テンプレート・デザイン素材はこちら