Sub pFillTH()
th = Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, ".", -1) - 1)
For Each pg In ActiveDocument.Pages
i = i + 1
qz = Left(th, Len(th) - 1)
xh = Right(th, 1) + i - 1
xth = qz & xh
‘设置文档单位为mm
ActiveDocument.Unit = cdrMillimeter
pgWidth = pg.SizeWidth - 2
’设置垫白层为矩形及尺寸
Dim s0 As Shape
Set s0 = pg.ActiveLayer.CreateRectangle(140, 4, 169, 1)
With s0
.Outline.SetNoOutline
.Fill.UniformColor.CMYKAssign 0, 0, 0, 0
End With
ActiveDocument.ReferencePoint = cdrBottomRight
s0.SetPosition pgWidth, 2
‘设置填充字体及样式
Dim s1 As Shape
Set s1 = pg.ActiveLayer.CreateArtisticText(0, 0, xth, , , "Arial", 6)
With s1
.Fill.UniformColor.CMYKAssign 0, 0, 0, 100
.Outline.SetNoOutline
End With
ActiveDocument.ReferencePoint = cdrBottomRight
s1.SetPosition pgWidth, 2
Next
ActiveDocument.Save
End Sub