Word宏設(shè)置圖片大小
1. Alt+F8, Create 一個Macro
2. 輸入Macro名,進(jìn)入編輯
---按比例縮小大量圖片
Sub alex() '設(shè)置圖片大小
Dim n '圖片個數(shù)
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 * 0.5 '設(shè)置高度為0.5倍
ActiveDocument.InlineShapes(n).Width = picwidth * 0.5 '設(shè)置寬度為0.5倍
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 * 0.5 '設(shè)置高度為0.5倍
ActiveDocument.Shapes(n).Width = picwidth * 0.5 '設(shè)置寬度為0.5倍
Next n
End Sub
---圖片大小設(shè)置成絕對值 1cm=28px
Sub alex() '設(shè)置圖片大小
Dim n '圖片個數(shù)
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 = 280 '設(shè)置高度為280px
ActiveDocument.InlineShapes(n).Width = 364 '設(shè)置寬度為364px
Next n
For n = 1 To ActiveDocument.Shapes.Count 'Shapes類型圖片
picheight = ActiveDocument.Shapes(n).Height
picwidth = ActiveDocument.Shapes(n).Width
ActiveDocument.Shapes(n).Height = 280 '設(shè)置高度為280px
ActiveDocument.Shapes(n).Width = 364 '設(shè)置寬度為364px
Next n
End Sub
3. 保持,再次進(jìn)入原來的word,alt-f8 run這個宏
網(wǎng)站名稱:Word宏設(shè)置圖片大小
分享地址:
http://weahome.cn/article/jespod.html