Alex
Alex

Reputation: 35781

VBA to apply style to all images in Word doc

Is it possible to apply a style or at least give a thin border to all the images in a Word 2013 document using VBA?

Upvotes: 1

Views: 3011

Answers (2)

Alex
Alex

Reputation: 21

If you want to apply a style to the images use this macro:

Sub set_image_to_figure_style()
  Dim pic As InlineShape
  For Each pic In ActiveDocument.InlineShapes
    pic.Select
    Selection.Style = ActiveDocument.Styles("Figure")
  Next
End Sub

Upvotes: 2

Jimmy Smith
Jimmy Smith

Reputation: 2451

The following should work,

Dim pic As InlineShape
For Each pic In ActiveDocument.InlineShapes
  pic.Borders.OutsideLineStyle = wdLineStyleSingle
  pic.Borders.OutsideLineWidth = wdLineWidth050pt
Next

Upvotes: 2

Related Questions