Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Problem positioning floating shapes in Word 2002

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eselick@gmail.com - 17 Dec 2005 00:41 GMT
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
Word Heretic - 20 Dec 2005 14:56 GMT
G'day eselick@gmail.com,

<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

eselick@gmail.com reckoned:

>Hi
>Here's my second problem.
[quoted text clipped - 43 lines]
>
>Elliot
Elliot - 27 Dec 2005 02:29 GMT
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
Word Heretic - 17 Jan 2006 08:54 GMT
G'day "Elliot" <eselick@gmail.com>,

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:

>Thanks for the tips.
>
[quoted text clipped - 22 lines]
>
>Elliot
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.