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 / April 2006

Tip: Looking for answers? Try searching our database.

Positioning an inline shape

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bo Hansson - 30 Mar 2006 13:17 GMT
I want to insert an inline shape into a table cell and then add text below
the shape.
In Word 2003 I'm using the following code (which works fine):

           .Move Unit:=wdCell, Count:=1
           .Expand wdCell
           .InlineShapes.AddPicture FileName:=<path> & "Picture.bmp"
           .InsertAfter vbCrLf
           .InsertAfter "Text"

However, when using the same code in Word 2000, it does not give the desired
result.
The shape then seems to choose its own position within the cell!

Please, tell me what to do.

/BosseH
Cindy M  -WordMVP- - 11 Apr 2006 09:26 GMT
Hi Bo,

> I want to insert an inline shape into a table cell and then add text below
> the shape.
[quoted text clipped - 10 lines]
> result.
> The shape then seems to choose its own position within the cell!

Please describe "seems to choose its own position within the cell".

Apparently, you're working with the Selection object (you really should copy
the ENTIRE code context!). It might be more predictable to work with a range
object. And I'd probably set an object variable to the InlineShape so that I
can get it's range. Maybe something like this:

   Dim ils as Word.InlineShape
   Dim rng as Word.Range

   Set ils = .InlineShapes.AddPicture FileName:=<path> & "Picture.bmp"
   Set rng = ils.Range
   rng.Collapse wdCollapseEnd
   rng.Text = vbCR & "Text"

Please note that Word does not use vbCRLF, and that this can, under
circumstances, give an "unexpected result".

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
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.