Problem positioning floating shapes in Word 2002

E

eselick

Hi
Here's my second problem.

The following code shows how I would like to vertically position my
image.

Set shpVersal = ActiveDocument.Shapes.AddPicture _
(FileName:="C:\ELLIOT\Versals\Wetstein\" & strLetter & ".gif", _
linktofile:=False, savewithdocument:=True, _
Anchor:=rngVersal)
With shpVersal
.WrapFormat.Type = wdWrapSquare
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapBoth
.WrapFormat.DistanceTop = 50
.WrapFormat.DistanceBottom = 20
.WrapFormat.DistanceLeft = 50
.WrapFormat.DistanceRight = 50
.LockAspectRatio = msoTrue
.LockAnchor = True
.Width = 77
.Height = 83
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionColumn
.Left = wdShapeCenter
.RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
.Top = 5.6
If .Top < 0 Then ' Debug code which never executes
Stop
End If
End With

The image inserts and when I step through the macro the top position is
correct, (the same as in the code). However when I let the macro run
normally I'm getting negative numbers for the top or vertical position.


Does anyone have any idea why this is happening?

My page layout is "Book Fold". The error did not occurr in the last
version of my macro and something must have changed in the environment
since when I restore the older version I'm still having the same
problem

Thanks a bunch,

Elliot
 
W

Word Heretic

G'day (e-mail address removed),

<shudders>

Inline pictures are SOOOOO much safer.

1) If you need pagination info, force it! Document.Repaginate after
the insert and before the set. You may even need to use an OnTime
command to completely delay

2) Addpicture takes top, left, width & height as well, use it there.

3) Have you considered using autotext instead?

4) Be careful of your sequence.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


(e-mail address removed) reckoned:
 
E

Elliot

Thanks for the tips.

Why are you talking about forcing a delay with the OnTime command. Why
is this necessary or rather what does it achieve?

Anyway getting gif files to insert consistently in Word is going to
drive me to drink. It should be simple, define a vertical and
horizontal position and put it there. Does this sound complicated? It's
turning into an exercise in Voodoo instead of programming. I could go
on and on about the different kinds of inconsistent results I'm
getting, but I'm sure it would be a waste of everybody's time. I can't
stop myself from describing one other one. I insert a floating picture
with use wdShapeCenter for both left and top. After adding a few more
pages I go back on click on page 1 of my folded book docuement and it
still shows alignment as centered. However on page 2 it displays my
notoriouos negative numbers again. Duh !! Maybe it's the folded book
page layout that triggers this "feature".

I had thought that positioning my grahpics independently of text would
the most rational approach and I've invested a lot of time. However,
you suggest using inline instead of floating shapes and perhaps I'll
go back to that.

Thanks for the help.

Elliot
 
W

Word Heretic

G'day "Elliot" <[email protected]>,

When word starts, it has to process all the document events before it
is finished processing the document and thus the document can be
considered properly loaded.

So, if we are processing inside a document start event, and we need to
do stuff with the document, such as obtain a handle to its window so
we can display a form on it (done for you by VBA when you Show a
form), we have to actually 'exit' our event and 'run something else in
a short period of time into the future'.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Elliot reckoned:
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top