Creating a macro in normal.dot from an external program using COM

  • Thread starter Francois Piette
  • Start date
F

Francois Piette

I have an external program that drive Word using COM. It works very well.
Now I would like this program to check if a given macro exists and if not,
create that macro and assign a keyboard shortcut to call it.

I think the problem would be the same as to have a VBA macro doing the same
work. I know how to implement a VBA macro from my outside program using COM.
So if you know how a mcaro can create a macro, it's OK for me !
 
J

Jonathan West

Hi Francois

I really would recommend you don't do this. The newer versions of Word are
set up by default to bar access to the object model for creating macros.
Therefore, if you don't have control of configuration of the systems where
these macros will be created, in many cases you won't be able to create the
macro in the first place. If you *do* have control of the syetm, then you
don't need to create the macro by this means.

In any case, normal.dot is the most unsafe place to put a macro. Instead,
copy a template into the user's Word startup folder. Next time Word is
started, any macros in the template will be availavle for use in the same
way as macros in normal.dot.

For more information on this, take a look at this article

Distributing macros to other users
http://word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm
 
F

Francois Piette

I really would recommend you don't do this. The newer versions of Word are
set up by default to bar access to the object model for creating macros.

I'm using Word 2000 only.
Therefore, if you don't have control of configuration of the systems where
these macros will be created, in many cases you won't be able to create the
macro in the first place. If you *do* have control of the syetm, then you
don't need to create the macro by this means.

I have control on the system but I have something like 500 systems to
update. I have a centralized, automated way to update the external
application but no way to update normal.dot on each of the computer. That's
my problem.
In any case, normal.dot is the most unsafe place to put a macro. Instead,
copy a template into the user's Word startup folder. Next time Word is
started, any macros in the template will be availavle for use in the same
way as macros in normal.dot.

That looks like a good solution for me. I'll experiment with this.
Thank you.
 

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