Create a macro to put border on all sides of the selected picture

Discussion in 'Word Programming' started by BobRoyAce, May 6, 2010.

  1. BobRoyAce

    BobRoyAce Guest

    I am trying to create a macro that will put a border around a picture,
    on all sides. The user will have to first select the picture, by
    clicking on it. Then, they will fire off the macro, either with a
    keyboard shortcut, or a button click. Upon doing so, I want the
    picture to have borders on all sides. Here's the code that I tried,
    but it seems to only put borders on the right and left sides. Any help
    would be muchly appreciated.


    Selection.InlineShapes(1).Line.Weight = 1.25
    Selection.InlineShapes(1).Line.DashStyle = msoLineSolid
    Selection.InlineShapes(1).Line.Visible = msoTrue
    Selection.InlineShapes(1).Line.ForeColor.RGB = RGB(0, 0, 0)

    --- MACRO CODE ENDS ---
    BobRoyAce, May 6, 2010
    1. Advertisements

  2. BobRoyAce

    BobRoyAce Guest

    I think that I figured it out. The following code seems to do just
    what I wanted...


    Selection.InlineShapes(1).Borders.OutsideLineStyle = wdLineStyleSingle
    Selection.InlineShapes(1).Borders.OutsideLineWidth = wdLineWidth150pt
    Selection.InlineShapes(1).Borders.OutsideColor = wdColorAutomatic

    --- MACRO CODE ENDS ---
    BobRoyAce, May 6, 2010
    1. Advertisements

  3. BobRoyAce


    Jul 24, 2016
    Likes Received:
    Thanks a lot BobRoyAce !!!
    Golu, Jul 24, 2016
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.