Cut_Number.bas 904 B

123456789101112131415161718192021222324252627282930313233343536
  1. Attribute VB_Name = "裁切编号"
  2. Sub ShapesRange()
  3. '// 代码运行时关闭窗口刷新
  4. Application.Optimization = True
  5. Dim d As Document
  6. Dim number As Shape
  7. Dim cnt As Integer
  8. cnt = 1
  9. Set d = ActiveDocument
  10. With ActiveLayer.Shapes
  11. MsgBox "总共有物件个数 " & .Count
  12. End With
  13. Dim s1 As Shape
  14. For Each Target In ActiveLayer.Shapes
  15. Set s1 = Target
  16. '设置颜色 s1.Fill.UniformColor.CMYKAssign 0, 100, 100, 0
  17. cx = s1.CenterX
  18. cy = s1.CenterY
  19. sw = s1.SizeWidth
  20. sh = s1.SizeHeight
  21. Text = Trim(Str(cnt))
  22. Set number = d.ActiveLayer.CreateArtisticText(cx, cy, Text)
  23. cnt = cnt + 1
  24. Next Target
  25. '// 代码操作结束恢复窗口刷新
  26. Application.Optimization = False
  27. ActiveWindow.Refresh
  28. Application.Refresh
  29. End Sub