求助:如何通过VBA批量选中word文档里的嵌入型图片或表格?

选中后统一调整格式。
2025-03-29 13:32:45
推荐回答(1个)
回答1:

提供示例代码供参考:

Sub BatEditPic()
    Dim ShapesCount As Integer
    Dim i As Integer
    ShapesCount = ActiveDocument.InlineShapes.Count
    For i = 1 To ShapesCount
        With ActiveDocument.InlineShapes(i)
            '修改图片边框
            With .Borders(wdBorderTop)
                .LineStyle = wdLineStyleSingle
                .LineWidth = wdLineWidth050pt
            End With
            With .Borders(wdBorderBottom)
                .LineStyle = wdLineStyleSingle
                .LineWidth = wdLineWidth050pt
            End With
            With .Borders(wdBorderLeft)
                .LineStyle = wdLineStyleSingle
                .LineWidth = wdLineWidth050pt
            End With
            With .Borders(wdBorderRight)
                .LineStyle = wdLineStyleSingle
                .LineWidth = wdLineWidth050pt
            End With
        End With
    Next i
End Sub