Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Smithfield, Free State, South Africa
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select Picture object (Word 2000)

    How do I create a VBA macro that will format a SELECTED picture that is aligned Inline text?
    It must change to aligned Top and bottom with a 0.1 space top and bottom.

    Each time I run the macro it must work with the selected picture only.
    Because the setting of the picture is Inling text alignment when it is pasted, that needs to be changed.

    My macro recording identifies the object by name and the macro does not work if I select another picture.

    Please help.

    Regards

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Picture object (Word 2000)

    Try something like this:

    With Selection.InlineShapes(1).ConvertToShape.WrapForma t
    .Type = wdWrapTopBottom
    .DistanceTop = InchesToPoints(0.1)
    .DistanceBottom = InchesToPoints(0.1)
    End With

    This takes the first (and presumably only) inline shape in the selection, converts it to a floating shape, then sets its wrapping options.

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Smithfield, Free State, South Africa
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Picture object (Word 2000)

    Works, however, instead of converting it to a floating shape (which hops to the top left corner of the page), is there a way to set the WrapTopBottom feature at the object position?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Picture object (Word 2000)

    Wrap Top and Bottom is only available for floating shapes, it makes no sense for inline shapes.

    If I run this code, the selected inline shape is converted to a floating shape at the original position, but then, I'm using Word 2002 SP-2; maybe it works differently from Word 2000 in this respect.

  5. #5
    3 Star Lounger
    Join Date
    May 2002
    Location
    Smithfield, Free State, South Africa
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Picture object (Word 2000)

    Might make a difference.
    When I paste objects (screen-dumps etc) on to the page, they appear automatically as inline objects.
    If I right-click on the object, select Format Object > Layout > Advanced> Top and Bottom, the item converts without moving.
    Not so when running the macro!!
    The SP different (I have SP1) might make a difference?, but in the meantime it is quicker to go the right-click route - unless I can somehow get this object to stand still!!!!
    Thanks Hans

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Picture object (Word 2000)

    I suspect the difference is 2002 vs 2000 more than SP-2 vs SP-1 <img src=/S/grin.gif border=0 alt=grin width=15 height=15>.
    I only have Word 97 and 2002 at my disposal, so I can't test on Word 2000.

  7. #7
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Picture object (Word 2000)

    let's backup here. Lynden, does the picture stay in the same place when you record the macro? if so, post it and we might be able to generalise it for all pictures.

    greetings, pieter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •