在撰写报告、制作简历或整理资料时,我们常常需要在Word文档中插入多张图片。但不同来源的图片尺寸不一,手动逐个调整既费时又容易出错。本文将介绍几种实用方法,帮助你快速统一Word文档中的图片大小。
Ctrl 键,依次点击每张图片进行多选;如果你熟悉VBA,可以使用以下简单宏代码自动统一所有图片尺寸:
Sub ResizeAllPictures()
Dim shp As Shape
Dim ilshp As InlineShape
For Each shp In ActiveDocument.Shapes
If shp.Type = msoPicture Then
shp.LockAspectRatio = msoTrue
shp.Width = CentimetersToPoints(10) ' 设置为10厘米宽
End If
Next shp
For Each ilshp In ActiveDocument.InlineShapes
If ilshp.Type = wdInlineShapePicture Then
ilshp.LockAspectRatio = msoTrue
ilshp.Width = CentimetersToPoints(10)
End If
Next ilshp
End Sub
使用前请先备份文档,并启用宏功能。