- 精华
- 活跃值
-
- 积分
- 591
- 违规
-
- 印币
-
- 鲜花值
-
- 在线时间
- 小时
尚未签到
|
Public Function Groub_dm(ss As ShapeRange) '群组代码 参数:选择的所有对象组
Dim s As Shape
Dim d1 As Document
Dim wz(7) As Double '位置参数
Dim sel As Shape '群组对象
Dim qzid As String
Set d1 = ActiveDocument
Dim i As Integer
Optimization = True '
wz(0) = Val(UserForm1.TextBox1.Text) - 1 '左侧出血
wz(1) = Val(UserForm1.TextBox3.Text) + 1 '上侧出血
wz(2) = Val(UserForm1.TextBox2.Text) + 1 '右侧出血
wz(3) = Val(UserForm1.TextBox4.Text) - 1 '下侧出血
ss.Sort " @shape1.width * @shape1.height > @shape2.width * @shape2.height" '把所有对象按从大到小重新排列
For Each s In ss
If InStr(qzid, "/" & s.StaticID & "/") = 0 Then '研究中,这个感觉速度不对...
wz(4) = s.LeftX + wz(0) '左X位置
wz(5) = s.TopY + wz(1) '左Y位置
wz(6) = s.RightX + wz(2) '右X位置
wz(7) = s.BottomY + wz(3) '右Y位置
Set sel = d1.ActivePage.SelectShapesFromRectangle(wz(4), wz(5), wz(6), wz(7), False) '查找对象
If sel.Shapes.Count > 1 Then
i = i + 1
sel.Group
For Each qz_sh In sel.Shapes '所群组后的所有对象ID连起来,后面判断用
qzid = qzid & "/" & qz_sh.StaticID & "/"
Next
End If
End If
Next
Optimization = False '
ActiveWindow.Refresh
End Function
|
|