Browse Source

智能群组和批量居中合并

Hongwenjun 1 year ago
parent
commit
293772403e
2 changed files with 10 additions and 7 deletions
  1. 9 6
      base/Batch_Center.bas
  2. 1 1
      donate.md

+ 9 - 6
base/Batch_Center.bas

@@ -1,6 +1,6 @@
 Attribute VB_Name = "Batch_Center"
-Public Sub 智能群组()
-If 0 = ActiveSelectionRange.Count Then Exit Sub
+Private Function Smart_Group() As ShapeRange
+If 0 = ActiveSelectionRange.Count Then Exit Function
   On Error GoTo ErrorHandler
   ActiveDocument.BeginCommandGroup:  Application.Optimization = True
   ActiveDocument.ReferencePoint = cdrBottomLeft
@@ -41,29 +41,32 @@ If 0 = ActiveSelectionRange.Count Then Exit Sub
   sr.Delete
 
   '// 矩形边界智能群组,删除矩形
+  Dim retsr As New ShapeRange
   For Each s In brk1
     Set sh = ActivePage.SelectShapesFromRectangle(s.LeftX, s.TopY, s.RightX, s.BottomY, False)
-    sh.Shapes.All.Group
+    retsr.Add sh.Shapes.All.Group
     s.Delete
   Next
 
+  Set Smart_Group = retsr
+
   ActiveDocument.EndCommandGroup
   Application.Optimization = False
   ActiveWindow.Refresh:    Application.Refresh
-Exit Sub
+Exit Function
 
 ErrorHandler:
   Application.Optimization = False
   MsgBox "请先选择一些物件来确定群组范围!"
   On Error Resume Next
 
-End Sub
+End Function
 
 
 ' 这个子程序遍历对象,调用解散物件和居中
 Public Sub start_Center()
     Dim s As Shape, ssr As ShapeRange
-    Set ssr = ActiveSelectionRange
+    Set ssr = Smart_Group
     For Each s In ssr
       Ungroup_Center s
     Next s

+ 1 - 1
donate.md

@@ -41,7 +41,7 @@ JZ捷众广告
 骑着"蜗牛"撵娘们
 极速龙广告装饰图文快印②
 a-嘉盟
-
+幼儿园最亮的仔
 ```
 
 ### 会员群福利: