Tuesday, July 10, 2018

Add a border to all images in Word document

To add a border to all images in a Word document, the record a macro feature will not work. Here is the code though that you can add your Microsoft Visual Basic for Applications.
Sub Borders()
' Adds a border of 0.25 width and colored 50% gray to every image in the document.
Dim pic As InlineShape
For Each pic In ActiveDocument.InlineShapes
    pic.Borders.OutsideLineStyle = wdLineStyleSingle
    pic.Borders.OutsideLineWidth = wdLineWidth025pt
    pic.Borders.OutsideColor = wdColorGray50
Next
End Sub