智能查找.bas 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Attribute VB_Name = "智能查找"
  2. Sub 一键加点工具()
  3. Dim OrigSelection As ShapeRange
  4. Set OrigSelection = ActiveSelectionRange
  5. If OrigSelection.Count <> 0 Then
  6. OrigSelection.Copy
  7. Else
  8. MsgBox "选择水洗标要加点部分,然后点击【加点工具】按钮!"
  9. Exit Sub
  10. End If
  11. ' 新建文件粘贴
  12. Dim doc1 As Document
  13. Set doc1 = CreateDocument
  14. ActiveLayer.Paste
  15. ' 转曲线,一键加粗小红点
  16. ActiveSelection.ConvertToCurves
  17. Call get_little_points
  18. End Sub
  19. Private Sub get_little_points()
  20. On Error GoTo ErrorHandler
  21. '// 代码运行时关闭窗口刷新
  22. Application.Optimization = True
  23. ActiveDocument.BeginCommandGroup '一步撤消'
  24. red_point_Size = 0.3
  25. ActiveDocument.Unit = cdrMillimeter
  26. Dim OrigSelection As ShapeRange, grp1 As ShapeRange, sh As Shape
  27. Set OrigSelection = ActiveSelectionRange
  28. Set grp1 = OrigSelection.UngroupAllEx
  29. grp1.ApplyUniformFill CreateCMYKColor(50, 0, 0, 0)
  30. For Each sh In grp1
  31. sh.BreakApartEx
  32. Next sh
  33. ActiveDocument.ClearSelection
  34. Dim sr As ShapeRange
  35. Set sr = ActivePage.Shapes.FindShapes(Query:="@width < {" & red_point_Size & " mm} and @width > {0.1 mm} and @height <{" & red_point_Size & " mm} and @height >{0.1 mm}")
  36. If sr.Count <> 0 Then
  37. sr.CreateSelection
  38. Set sh = ActiveSelection.Group
  39. sh.Outline.SetProperties 0.03, Color:=CreateCMYKColor(0, 100, 100, 0)
  40. sr.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0)
  41. sh.Move 0, 0.015
  42. sh.Copy
  43. Else
  44. MsgBox "文件中小圆点足够大,不需要加粗!"
  45. End If
  46. ActivePage.Shapes.FindShapes(Query:="@colors.find(CMYK(50, 0, 0, 0))").CreateSelection
  47. ActiveSelection.Group
  48. ActiveDocument.EndCommandGroup
  49. Application.Optimization = False
  50. ActiveWindow.Refresh
  51. Application.Refresh
  52. Exit Sub
  53. ErrorHandler:
  54. MsgBox "选择水洗标要加点部分,然后点击【加点工具】按钮!"
  55. Application.Optimization = False
  56. On Error Resume Next
  57. End Sub
  58. Sub 文字转曲()
  59. Tools.TextShape_ConvertToCurves
  60. End Sub