R
roblit
I have developed a Word macro that loops through a multipage document (of
letters) placing various images from the clipboard into the letters and then
surrounding each image by a text box.
My problem is that when I run it using RUN the textbox and image go to the
TOP of the page.
Yet when run in single step mode with F8, the image and text box correctly
stay at the current position on the page.
I have tried DoEvents and Sleep but it does not help.
Here is a cutdown piece of my code. It seems to be the Selection.ShapeRange
line that causes the movement to the top of the page.
Selection.Paste 'paste images from clipboard
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.CreateTextbox
Selection.ShapeRange.IncrementLeft 2.8
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=""
' goto next page
To test it, first paste a small image onto the clipboard then go part way
down the 2nd page of a document then run the macro
I am using Word2003 with SP3, on XP pro v2002 SP3
Many thanks for looking at this.
Roblit
letters) placing various images from the clipboard into the letters and then
surrounding each image by a text box.
My problem is that when I run it using RUN the textbox and image go to the
TOP of the page.
Yet when run in single step mode with F8, the image and text box correctly
stay at the current position on the page.
I have tried DoEvents and Sleep but it does not help.
Here is a cutdown piece of my code. It seems to be the Selection.ShapeRange
line that causes the movement to the top of the page.
Selection.Paste 'paste images from clipboard
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.CreateTextbox
Selection.ShapeRange.IncrementLeft 2.8
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=""
' goto next page
To test it, first paste a small image onto the clipboard then go part way
down the 2nd page of a document then run the macro
I am using Word2003 with SP3, on XP pro v2002 SP3
Many thanks for looking at this.
Roblit