Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Apr 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Recording Macro (Word XP)

    While recording a macro I can insert a picture into the header but can not adjust its position. I can not create a text box to put a picture in. These were available in word 2000 and older. This is the way I create letterhead stationary, either across the top or along the side.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Recording Macro (Word XP)

    A little hard to tell exactly what's happening. When you insert the picture while recording the macro, what is keeping you from adjusting its position?

    Word 2002 defaults to inserting pictures as inline objects, which may have been different in earlier versions of Word, but in any case, to adjust the position of the object, you first have to select it - which is a little more difficult to do while recording a macro.
    While recording the macro, after you have inserted the picture, you should then be able to select it by holding down the Shift key and then press the left arrow.
    Once the picture is selected this way, you can adjust its position a couple of ways: (1) click and drag the indent markers on the ruler; (2) change the indent settings in Paragraph > Format.

    You can also convert the picture from an inline to a floating object in your code, but this would require some written code to be added later, after you have recorded the macro.

    Gary

  3. #3
    New Lounger
    Join Date
    Apr 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Recording Macro (Word XP)

    Gary selecting the picture was part of the problem, Thanks for the keyboard combo. I need to put a 1.5 " wide by 9" tall picture down the left side of the page and print to the right of it. If I use the watermark method in XP I can not get the pic out of the middle of the page and not print over. If I insert pic to page and position then I can not format and word wrap (option is grayed out)
    Bruce

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Recording Macro (Word XP)

    When you insert the picture it will either be a Shape or an InlineShape. This is determined by settings in Tools > Options > Edit.

    If it is an InlineShape then you can select it using the VBA command
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend

    You can then manipulate the shape with commands like
    With Selection.InlineShapes(1)
    .Height = InchesToPoints(9.0)
    .Width = InchesToPoints(1.5)
    End With

    If you have inserted a shape then you don't need the "Selection.MoveLeft" above and you should be able to use
    With ActiveDocument.Shapes(ActiveDocument.Shapes.Count)
    .Height = InchesToPoints(9.0)
    .Width = InchesToPoints(1.5)
    End With

    If you place the cursor in the word Shapes or InlineShapes and type F1 then the help will show all the properties so you can identify the ones you need to change.

    If you need to write a Macro that will run on someone else's PC and you don't know how they have set Tools > Options > Edit you can note the value of ActiveDocument.Shapes.Count before and after inserting the shape, if it went up by one then they inserted a Shape, if it stayed the same then they inserted an InlineShape.

    StuartR

  5. #5
    New Lounger
    Join Date
    Apr 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Recording Macro (Word XP)

    StuartR Thank you for the help. With you and Gary's help I have solved my Problem. What used to be a very simple job certainly became more complicated in XP. I made the mistake of thinking things got easier.

Posting Permissions

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