宏代码:2.54即页边距;29.7X21即A4纸的大小;根据需要自己调整(VBA自学的,没搞明白怎么自动获取这些值,知道的欢迎回贴!3Q)
-----------------------------------------------------------------------------------------------------------------
Sub 图片按页宽等比缩放()
Dim n '图片个数
Dim myShape As Variant
Dim picheight
Dim picwidth
Dim pheight
Dim pwidth
For n = 1 To doc.InlineShapes.Count 'InlineShapes类型图片
Set myShape = doc.InlineShapes(n)
myShape.LockAspectRatio = msoTrue
picheight = myShape.Height / myShape.ScaleHeight * 100
picwidth = myShape.Width / myShape.ScaleWidth * 100
If picheight > pheight Or picwidth > pwidth Then
If picheight / pheight > picwidth / pwidth Then
myShape.ScaleHeight = Fix(pheight / picheight * 100)
Else
myShape.ScaleWidth = Fix(pwidth / picwidth * 100)
End If
Else
myShape.ScaleHeight = 100
myShape.ScaleWidth = 100
End If
Next n