Word宏命令实现自动调整图片大小

Auth:焱讲       Date:2021/10/14       Cat:文章精选       Word:共643字

已关闭评论

自动切图片代码

Sub 批量图片大小()

Dim iSha As InlineShape

For Each iSha In ActiveDocument.InlineShapes

If iSha.Type = wdInlineShapePicture Then

'iSha.LockAspectRatio = msoFalse '不锁定纵横比

iSha.LockAspectRatio = msoTrue '锁定纵横比

iSha.Width = CentimetersToPoints(5) '宽CM

'iSha.Height = CentimetersToPoints(6) '高CM

End If

Next

End Sub

自动添加边框

Sub 设置图片边框()

    Dim oInlineShape As InlineShape

    Application.ScreenUpdating = False

    For Each oInlineShape In ActiveDocument.InlineShapes

        With oInlineShape.Borders

            .OutsideLineStyle = wdLineStyleSingle

            .OutsideColorIndex = wdColorAutomatic

            .OutsideLineWidth = wdLineWidth050pt

        End With

    Next

    Application.ScreenUpdating = True

End Sub

      

评论已关闭!