Macros and Smart Tags

G

George Lee

Can macros be run as a result of a Smart Tag action statement?

For example, if I'm in Word using Smart Tags, can one of the actions be used
to start a Word macro?
 
P

Peter Jamieson

It's a while since I did this stuff, but it can certainly be done in
certain circumstances, because the code that executes the Action is
passed a reference to the Range in the document that corresponds to the
recognised text. This allows the action code to replace that text (e.g.
to replace a city shortcode by the full city name). So a typical bit of
Action code might be

e.Range.Text = "full city name"

However, that also lets you do

e.Range.Application.Run "macroname"

and I have just verified that starting with a smart tag written in
VB.NET, you can call a macro in Normal using that mechanism.

However,
a. I can't give you any more detail than that. In particular, I can't
tell you whether this is a reliable mechanism
b. I think you would have to write your own Smart tag code - I can't
see how you could do this using a MOSTL list

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv
 

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