サンプルコードでできること
カーソルのあるページのオートシェイプ等の図をすべてグループ化します。
Sub アクティブページの図形を選択とグループ化() If Selection.Type = 8 Then MsgBox "図形が選択されています。図を選択しないで実行してください" Exit Sub End If アクティブページの図形を選択 If Selection.ShapeRange.Count <= 1 Then MsgBox "図が1つのみのため、グループ化できません" Exit Sub End If Selection.ShapeRange.Group End Sub Sub アクティブページの図形を選択() Dim shp As Shape ActiveWindow.View.Type = wdPrintView If Selection.Type = wdSelectionShape Then MsgBox "図形が選択されています。" Exit Sub End If For Each shp In ActiveDocument.Bookmarks("\Page").Range.ShapeRange shp.Select Replace:=False Next shp End Sub
コードの説明
For Each shp In ActiveDocument.Bookmarks("\Page").Range.ShapeRange shp.Select Replace:=False Next shp
For Exch構文を用いて、ページ内の図形を1つずつ選択します。