代码中单位厘米
(1)设置固定大小n厘米
Sub resetImgSize()
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
iShape.LockAspectRatio = msoTrue
iShape.Height = CentimetersToPoints(n)
iShape.Width = CentimetersToPoints(n)
Next
End Sub
(2)等比例缩放n倍
Sub resetImgSize()
Dim imgHeight
Dim imgWidth
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
iShape.LockAspectRatio = msoTrue
imgHeight = iShape.Height
imgWidth = iShape.Width
iShape.Height = CentimetersToPoints(n * imgHeight )
iShape.Width = CentimetersToPoints(n * imgWidth)
Next
End Sub
(3)最大宽度n厘米等比例缩放
Sub resetImgSize()
Dim imgHeight
Dim imgWidth
Dim iShape As InlineShape
For Each iShape In ActiveDocument.InlineShapes
iShape.LockAspectRatio = msoTrue
imgHeight = iShape.Height
imgWidth = iShape.Width
iShape.Height = CentimetersToPoints(n * imgHeight / imgWidth)
iShape.Width = CentimetersToPoints(n)
Next
End Sub
因篇幅问题不能全部显示,请点此查看更多更全内容