问题
I'm trying to optimise my macro which allow me to ungroup all the shapes that are located in that active Page and if those shapes are already Ungrouped this macro will Group them
What I want to do is to modify this code to allow to group and Ungroup all in the Active page only not all te document . I'm a little noobi with VBA this is my code
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 'Ungrouping all shapes in all the document :(
If S.Selection.Ungroup = True Then
ActiveDocument.Selection.ShapeRange.Regroup ' Problem here
Next
Next
End Sub
I need a quick help
the error is methode unfound for the Regroup
and S.Selection.Ungoup
来源:https://stackoverflow.com/questions/46246261/grouping-shapes-vba-word-macro