在 Microsoft Word 中自动调整图像大小(增加屏幕截图的大小)

在 Microsoft Word 中自动调整图像大小(增加屏幕截图的大小)

我需要单击一下来调整(增加)Word 文档中的多个屏幕截图的大小。

我有一个宏。下面是一个。

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

我看了看这个教程我写了这段代码:

 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

我不是程序员,所以这只是一次尝试:)

相关内容