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.

    --- MACRO CODE BEGINS ---

    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
    1. Advertisements

  2. BobRoyAce

    BobRoyAce Guest

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

    --- MACRO CODE BEGINS ---

    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
    #2
    1. Advertisements

  3. BobRoyAce

    Golu

    Joined:
    Jul 24, 2016
    Messages:
    1
    Likes Received:
    0
    Thanks a lot BobRoyAce !!!
     
    Golu, Jul 24, 2016
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. OTWarrior via OfficeKB.com

    selected previously selected item (bookmark)

    OTWarrior via OfficeKB.com, Aug 30, 2007, in forum: Word Programming
    Replies:
    4
    Views:
    140
    macropod
    Sep 3, 2007
  2. Manish Bafna

    Change border color of a row in word table

    Manish Bafna, Sep 4, 2007, in forum: Word Programming
    Replies:
    0
    Views:
    101
    Manish Bafna
    Sep 4, 2007
  3. Macro''''er

    Put certain text to clipboard macro

    Macro''''er, Feb 13, 2009, in forum: Word Programming
    Replies:
    0
    Views:
    106
    Macro''''er
    Feb 13, 2009
  4. nitesh bansal

    Open a picture as a picture and paste it in word

    nitesh bansal, Feb 17, 2009, in forum: Word Programming
    Replies:
    1
    Views:
    121
    Doug Robbins - Word MVP
    Feb 17, 2009
  5. Macro''''er

    macro to put certain text to clipboard

    Macro''''er, Feb 17, 2009, in forum: Word Programming
    Replies:
    1
    Views:
    108
    Doug Robbins - Word MVP
    Feb 17, 2009
  6. BobRoyAce
    Replies:
    1
    Views:
    263
    Jay Freedman
    Apr 13, 2010
  7. John
    Replies:
    2
    Views:
    250
  8. John
    Replies:
    1
    Views:
    203
    Greg Maxey
    Aug 27, 2010
Loading...