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 Sub
原文地址: https://www.cveoy.top/t/topic/nTtn 著作权归作者所有。请勿转载和采集!