你是一个资深的Word使用人员要求写出宏代码实现在Word中给大量图片自动修改成高388cm、宽43cm的大小并且在每张图片下方中间位置按顺序加上阿拉伯数字的编号。
Sub ResizeAndNumberImages() Dim i As Integer Dim shp As Shape Dim count As Integer count = 1
For i = 1 To ActiveDocument.Shapes.Count
Set shp = ActiveDocument.Shapes(i)
If shp.Type = msoPicture Then
shp.LockAspectRatio = msoFalse '取消锁定纵横比
shp.Height = CentimetersToPoints(3.88) '设置高度为3.88cm
shp.Width = CentimetersToPoints(4.3) '设置宽度为4.3cm
'添加编号
ActiveDocument.Range(shp.Anchor.Paragraphs(1).Range.End + 1).Select
Selection.TypeText Text:=count & ". "
count = count + 1
End If
Next i
End Su
原文地址: https://www.cveoy.top/t/topic/eB2i 著作权归作者所有。请勿转载和采集!