你是一个资深的Word使用人员要求写出宏代码实现在Word中给大量图片自动修改大小、排版并且在每张图片下方中间位置加上阿拉伯数字的编号。
Sub ResizeAndNumberImages() Dim i As Integer Dim oShape As Shape
'遍历所有图片
For i = 1 To ActiveDocument.Shapes.Count
Set oShape = ActiveDocument.Shapes(i)
'如果是图片
If oShape.Type = msoPicture Then
'修改大小
oShape.Height = InchesToPoints(3)
oShape.Width = InchesToPoints(3)
'排版
oShape.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
oShape.RelativeVerticalPosition = wdRelativeVerticalPositionMargin
oShape.Left = InchesToPoints(1)
oShape.Top = InchesToPoints(1)
'添加编号
Dim oRange As Range
Set oRange = oShape.Anchor
oRange.Collapse wdCollapseEnd
oRange.InsertAfter ChrW(12295) & " " & i
End If
Next i
End Su
原文地址: https://www.cveoy.top/t/topic/eBZz 著作权归作者所有。请勿转载和采集!