forked from hongwenjun/corelvba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cut_Number.bas
36 lines (29 loc) · 904 Bytes
/
Cut_Number.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Attribute VB_Name = "裁切编号"
Sub ShapesRange()
'// 代码运行时关闭窗口刷新
Application.Optimization = True
Dim d As Document
Dim number As Shape
Dim cnt As Integer
cnt = 1
Set d = ActiveDocument
With ActiveLayer.Shapes
MsgBox "总共有物件个数 " & .Count
End With
Dim s1 As Shape
For Each Target In ActiveLayer.Shapes
Set s1 = Target
'设置颜色 s1.Fill.UniformColor.CMYKAssign 0, 100, 100, 0
cx = s1.CenterX
cy = s1.CenterY
sw = s1.SizeWidth
sh = s1.SizeHeight
Text = Trim(Str(cnt))
Set number = d.ActiveLayer.CreateArtisticText(cx, cy, Text)
cnt = cnt + 1
Next Target
'// 代码操作结束恢复窗口刷新
Application.Optimization = False
ActiveWindow.Refresh
Application.Refresh
End Sub