Accessing Word object model from new thread

N

Nick Jardine

Hello,

I am writing a Word 2003 add-in that is supposed to detect when a user
activates an Autotext "shortcut", and convert the resulting phrase to a
hyperlink. I was unable to find a way to be directly notified of a user
activating an auto-text completion, and came up with a work-around involving
inserting the auto text with a blank URL (eg http://blank), and combining it
with a thread that wakes up every frew seconds parsing the document for the
blank URLs and fills them in with the dynamicly generated details that we
need.

From the thread I can read data from word fine (specifically, the Address of
the hyperlink), but cannot modify that data without getting a memory access
violation that crashes word (this is NOT a _com_error exception not being
caught - it is an actual memory access violation within word itself).

Is there any trick necessary to be able to safely access the Word object
model from a user thread, or is it just flat-out not possible?

Alternately, is there any way to have word send an event to an add-in when
the user creates a hyperlink or triggers an Autotext completion?

Any help would be appreciated.
Regards,
Nick Jardine
 
B

- B@rney

Have you looked into SmartTags?

The SmartTag has a recognizer that continously parses text in the document.

HTH
 
N

Nick Jardine

Yes, SmartTags were the first thing I tried, but the problem there is that I
could find no way of automatically carrying out the smart tag action - it
still required some form of user input to "force" the action.

Thanks anyway for the suggestion.
Nick Jardine
 

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