TAG or Name for OLEObjects?

O

Office Engineer

Hi
I have a document where I am programmaticly adding an
InlineShapes.OLEObject. Sometimes it is the first object sometimes not. I
need a way to identify the new object at run time. As I understand it, each
OLEObj has a certaim Item property but that can later change if an earlier
OLEObj is deleted.
Running MSWord 2003 on XP
 
C

Cindy M.

Hi =?Utf-8?B?T2ZmaWNlIEVuZ2luZWVy?=,
I have a document where I am programmaticly adding an
InlineShapes.OLEObject. Sometimes it is the first object sometimes not. I
need a way to identify the new object at run time. As I understand it, each
OLEObj has a certaim Item property but that can later change if an earlier
OLEObj is deleted.
Running MSWord 2003 on XP
If the OLE objects are InlineShapes then you can't assign them a Name or a
Tag. What you can do is place a bookmark around them. The pseudo code, very
roughly (meaning I'm writing this off the top of my head):

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

Set ils = InlineShapes.AddOLEObject('parameters here)
Set rng = ils.Range
Set bkm = ActiveDocument.Bookmarks.Add(rng, "OLEShapeTag")

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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 :)
 

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