取消组合/重新组合形状VBA Word

时间:2017-09-15 14:49:08

标签: excel vba word-vba

我正在尝试在活动文档中创建一个Groupe和Ungroupe Shapes in Word的新宏。 我成功了,但我在再次分组形状时遇到了问题 我的代码是

Private Sub degroupage_Click()
Dim mydocument As Document
Set mydocument = ActiveDocument
On Error Resume Next

ActiveDocument.Unprotect   'enregistré manuellement
Dim S As Shape, t As Shape

For i = 0 To mydocument.Shapes.Item(1).GroupItems.Count
For Each S In mydocument.Shapes
    If S.Type = msoGroup Then S.Ungroup
If S.Type = msoGroup Then S.Regroup

Next
Next

End Sub

错误:“Membredeméthodeoudedonnéesintrouvable” S.Regroup

我不知道应该改变什么

提前谢谢

0 个答案:

没有答案