记录一下,批量改图是一个很好的思路.早就听说了word宏,一直没有用过.今天(20171207)用了下,觉得的确不错.
操作步骤:
- 1 ALT+F8 进入宏编辑模式,输入name->create
- 2 输入宏代码
- 3 宏代码中调整要设置的大小 Mywidth ,Myheigth
- 4 F5 run it
5 对于单个或者范围内改图大小,最好添加一个自定义的快捷键.这样改起来操作流畅.
附相关宏代码VBA, 全文档的宏代码是从网上找的,后两个是研究了一下MS文档扩展改进的.
1. 全文档范围内修改图片大小
Attribute VB_Name = "NewMacros"
Sub autopic()
' autopic Macro
'
Mywidth = 4.13
Myheigth = 5.48
For Each iShape In ActiveDocument.InlineShapes
iShape.Height = 28.345 * Myheigth
iShape.Width = 28.345 * Mywidth
Next iShape
End Sub
2. 单个选中修改图片大小
Sub autopicSing()
' autopicSing Macro
'
Mywidth = 8.13
Myheigth = 5.48
'For Each iShape In ActiveWindow.Selection.ShapeRange
With Selection.InlineShapes(1)
.Height = 28.345 * Myheigth
.Width = 28.345 * Mywidth
End With
'Next iShape
End Sub
3. 选中范围后批量修改图片大小
Sub autopicRange()
' autopicRange Macro'
'
Mywidth = 8.13
Myheigth = 5.48
'For Each iShape In ActiveWindow.Selection.ShapeRange
For Each iShape In Selection.InlineShapes
iShape.LockAspectRatio = msoFalse
iShape.Height = 28.345 * Myheigth
iShape.Width = 28.345 * Mywidth
Next iShape
End Sub
###添加自定义的快捷键
word版本不同,略有不同.
1. 进入word options
2.在自定义中添加快捷键