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

Tip: Looking for answers? Try searching our database.

adding text before and after an image

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rani - 21 Sep 2006 23:36 GMT
i have to add a text <image> before all the images and </image> after all the
images in a MS word doc using VBA coding.

can anyone help me with its code?
Jezebel - 21 Sep 2006 23:55 GMT
Dim pShape as Word.Shape
For each pShape in ActiveDocument.InlineShapes
   with pShape.Range
       .InsertBefore "<image>"
       .InsertAfter "</image">
   end with
Next

This assumes that your images are inline (rather than floating). If they're
floating, you'll need to provide more info about the intended result.

>i have to add a text <image> before all the images and </image> after all
>the
> images in a MS word doc using VBA coding.
>
> can anyone help me with its code?
rani - 22 Sep 2006 00:30 GMT
Dear Jezebel
thanks for your help. i tried your code but it is not working. it shows some
error in the third line of your code. it selects ".range" and gives a message
that data member not found.

> Dim pShape as Word.Shape
> For each pShape in ActiveDocument.InlineShapes
[quoted text clipped - 12 lines]
> >
> > can anyone help me with its code?
Helmut Weber - 22 Sep 2006 01:03 GMT
Hi Rani,

>> Dim pShape as Word.Shape
  Dim pShape as Word.InlineShape

>>  .InsertAfter "</image">
   .InsertAfter "</image>"

It's cheap, of course,
to correct a minor mistake and a typo.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"


Rate this thread:






 
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.