Sub setpicsize() '设置图片大小 Dim n ' 图片个数 On Error Resume Next ' 忽略错误 For n = 1 To ActiveDocument.InlineShapes.Count 'InlineShapes 类型图片 ActiveDocument.InlineShapes(n).Height = 400 '设置图片高度为 400px ActiveDocument.InlineShapes(n).Width = 300 '设置图片宽度 300px Next n For n = 1 To ActiveDocument.Shapes.Count 'Shapes 类型图片 ActiveDocument.Shapes(n).Height = 400 '设置图片高度为 400px ActiveDocument.Shapes(n).Width = 300 '设置图片宽度 300px Next n End Sub
Sub Macro() Mywidth=10 ‘10为图片宽度(厘米) Myheigth=10 ‘10为图片高度(厘米) For Each iShape In ActiveDocument.InlineShapes iShape.Height = 28.345 * Myheigth iShape.Width = 28.345 * Mywidth Next iShape End Sub
Sub setpicsize() '设置图片大小 Dim n '图片个数 Dim picwidth Dim picheight On Error Resume Next '忽略错误 For n = 1 To ActiveDocument.InlineShapes.Count 'InlineShapes 类型图片 picheight = ActiveDocument.InlineShapes(n).Height picwidth = ActiveDocument.InlineShapes(n).Width ActiveDocument.InlineShapes(n).Height = picheight * 1.1 '设置高度为1.1倍 ActiveDocument.InlineShapes(n).Width = picwidth * 1.1 '设置宽度为1.1倍 Next n For n = 1 To ActiveDocument.Shapes.Count 'Shapes类型图片 picheight = ActiveDocument.Shapes(n).Height picwidth = ActiveDocument.Shapes(n).Width ActiveDocument.Shapes(n).Height = picheight * 1.1 '设置高度为1.1倍 ActiveDocument.Shapes(n).Width = picwidth * 1.1 '设置宽度为1.1倍 Next n End Sub