然后alt+F8进入宏查看界面,点击运行即可。
在VBA窗口中双击左侧的“ThisDocument”打开该文档的代码编辑器,并且输入以下的内容。
Sub FormatPics()
Dim TuPian As InlineShape
For Each TuPian In ActiveDocument.InlineShapes
If TuPian.Type = wdInlineShapePicture Then
TuPian.LockAspectRatio = msoFalse '不锁定图片的宽高比
TuPian.Width = CentimetersToPoints(10) '设置图片宽度为10CM
TuPian.Height = CentimetersToPoints(8) '设置图片高度为8CM
End If
Next
End Sub
不锁定图片的宽高比
程序:
Sub FormatPics()
Dim TuPian As InlineShape
For Each TuPian In ActiveDocument.InlineShapes
If TuPian.Type = wdInlineShapePicture Then
TuPian.LockAspectRatio = msoTrue '不锁定图片的宽高比
End If
Next
End Sub