Option Explicit
Option Base 0
'
Public Sub モロッカン柄描画マクロ()
Const MOROLEFT = 100 '描画開始位置X
Const MOROTOPP = 70 ' Y
'
Const MORORADI = 12 '半円の半径
Const MOROSTLN = 6 '直線の長さ
Const MOROCOLS = 8 '横描画数
Const MOROROWS = 3 '縦描画数
'
Const MOROLNWE = 2 '線の太さ
'---------------------------------------------------------------------------
Dim Ip As Integer, Jp As Integer
Dim intDxp As Integer, intDyp As Integer
Dim lngCol As Long
'
lngCol = RGB(47, 79, 79) '←線色
For Ip = 0 To MOROCOLS - 1
intDxp = MOROLEFT + (MORORADI * 2) * Ip
For Jp = 0 To MOROROWS - 1
intDyp = MOROTOPP _
+ ((MORORADI * 2 + MOROSTLN) * 2) * Jp
'*第一直線描画
With ActiveDocument.Shapes.AddLine( _
intDxp, intDyp, intDxp, intDyp + MOROSTLN).Line
.ForeColor.RGB = lngCol
.Weight = MOROLNWE
End With
'*第一半円描画
With ActiveDocument.Shapes.AddShape( _
msoShapeArc, intDxp - MORORADI, _
intDyp + MOROSTLN, MORORADI * 2, MORORADI * 2)
.Fill.Visible = False
.Line.Visible = True
.Line.ForeColor.RGB = lngCol
.Line.Weight = MOROLNWE
.Adjustments(1) = IIf((Ip Mod 2) = 0, -90, 90)
.Adjustments(2) = IIf((Ip Mod 2) = 0, 90, 270)
End With
'*第二直線描画
intDyp = intDyp + MOROSTLN + MORORADI * 2
With ActiveDocument.Shapes.AddLine( _
intDxp, intDyp, _
intDxp, intDyp + MOROSTLN).Line
.ForeColor.RGB = lngCol
.Weight = MOROLNWE
End With
'*第二半円描画
With ActiveDocument.Shapes.AddShape( _
msoShapeArc, intDxp - MORORADI, _
intDyp + MOROSTLN, MORORADI * 2, MORORADI * 2)
.Fill.Visible = False
.Line.Visible = True
.Line.ForeColor.RGB = lngCol
.Line.Weight = MOROLNWE
.Adjustments(1) = IIf((Ip Mod 2) = 0, 90, -90)
.Adjustments(2) = IIf((Ip Mod 2) = 0, 270, 90)
End With
Next Jp
Next Ip
End Sub