word批量給word中的圖片加邊框
工具/原料
word2010
方法/步驟
打開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