Microsoft Word で画像のサイズを自動的に変更 (スクリーンショットのサイズを大きく)

Microsoft Word で画像のサイズを自動的に変更 (スクリーンショットのサイズを大きく)

Word 文書内の複数のスクリーンショットを 1 回のクリックでサイズ変更 (サイズを拡大) する必要があります。

私はマクロを持っています。以下がそのマクロです。

Sub ResizePics()
 Dim shp As Word.Shape
 Dim ishp As Word.InlineShape
 If Word.Selection.Type <> wdSelectionInlineShape And _
 Word.Selection.Type <> wdSelectionShape Then
 Exit Sub
 End If
 If Word.Selection.Type = wdSelectionInlineShape Then
 Set ishp = Word.Selection.Range.InlineShapes(1)
 ishp.LockAspectRatio = False
 ishp.Height = InchesToPoints(1.78)
 ishp.Width = InchesToPoints(3.17)
 Else
 If Word.Selection.Type = wdSelectionShape Then
 Set shp = Word.Selection.ShapeRange(1)
 shp.LockAspectRatio = False
 shp.Height = InchesToPoints(1.78)
 shp.Width = InchesToPoints(3.17)
 End If
 End If
 End Sub

ただし、上記のマクロは 1 つのスクリーンショットに対してのみ機能します。選択したすべての画像のサイズを変更する場合は、何らかの変更が必要です。

マクロの修正にご協力ください。

答え1

これを見てみましたチュートリアルそして私はそのコードを書きました:

 Sub ResizePics()
 Dim shp As Word.Shape
 Dim ishp As Word.InlineShape

For Each ishp In ActiveDocument.InlineShapes
 ishp.LockAspectRatio = False
 ishp.Height = InchesToPoints(1.78)
 ishp.Width = InchesToPoints(3.17)
Next ishp

For Each shp In ActiveDocument.Shapes
 shp.LockAspectRatio = False
 shp.Height = InchesToPoints(1.78)
 shp.Width = InchesToPoints(3.17)
Next shp
 End Sub

私はプログラマーではないので、これは単なる試みです :)

関連情報