通过执行宏命令批量给word中的图片加边框

作者:暴躁小n | 创建时间: 2023-08-08
word批量给word中的图片加边框...
通过执行宏命令批量给word中的图片加边框

操作方法

打开word中的视图标签卡,选择宏,然后查看宏

创建宏命令,自己可以命名也可以使用系统中的名字,这个不影响最后的效果

粘贴如下代码: Sub Example() 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

执行宏命令

最终效果

温馨提示

想要边框更粗的话可以使用如下代码
Sub Example() Dim oInlineShape As InlineShape Application.ScreenUpdating = False For Each oInlineShape In ActiveDocument.InlineShapes With oInlineShape.Borders .OutsideLineStyle = wdLineStyleThinThickSmallGap .OutsideColorIndex = wdColorAutomatic .OutsideLineWidth = wdLineWidth300pt End With Next Application.ScreenUpdating = True End Sub
点击展开全文

更多推荐