|
用宏批量修改Word中图片缩放比例出错,提示:编译错误。
如下:
Sub setpicsize() '设置图片大小
Dim n '图片个数
Dimpicwidth
Dimpicheight
On Error Resume Next '忽略错误
For n = 1 ToActiveDocument.InlineShapes.Count 'InlineShapes类型图片
picheight = ActiveDocument.InlineShapes(n).Height
picwidth = ActiveDocument.InlineShapes(n).Width
ActiveDocument.InlineShapes(n).Height = picheight * 0.9 '设置高度为0.9倍
ActiveDocument.InlineShapes(n).Width = picwidth * 0.9 '设置宽度为0.9倍
Nextn
For n = 1 To ActiveDocument.Shapes.Count 'Shapes类型图片
picheight = ActiveDocument.Shapes(n).Height
picwidth = ActiveDocument.Shapes(n).Width
ActiveDocument.Shapes(n).Height = picheight * 0.9 '设置高度为0.9倍
ActiveDocument.Shapes(n).Width = picwidth * 0.9 '设置宽度为0.9倍
Nextn
End Sub
|
|