Word宏設置圖片大小
Word宏設置圖片大小
1. Alt+F8, Create 一個Macro
2. 輸入Macro名,進入編輯
---按比例縮小大量圖片
Sub alex() '設置圖片大小
Dim n '圖片個數
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 '設置高度為0.5倍
ActiveDocument.InlineShapes(n).Width = picwidth * 0.5 '設置寬度為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 '設置高度為0.5倍
ActiveDocument.Shapes(n).Width = picwidth * 0.5 '設置寬度為0.5倍
Next n
End Sub
---圖片大小設置成絕對值 1cm=28px
Sub alex() '設置圖片大小
Dim n '圖片個數
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 '設置高度為280px
ActiveDocument.InlineShapes(n).Width = 364 '設置寬度為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 '設置高度為280px
ActiveDocument.Shapes(n).Width = 364 '設置寬度為364px
Next n
End Sub
3. 保持,再次進入原來的word,alt-f8 run這個宏