|
|
|
date: 8 Mar 2006 00:40:13 -0800,
group: microsoft.public.word.vba.addins
back
Re: How to run autoexec macro in addins programmatically
> AutoExec macros only execute when Word starts, and the Add-ins are
> located in the Startup folder. They do not run when loaded over the
> Addins collection.
I have to disagree with you on that, Cindy. AutoExec macros in global
templates should run when the template is loaded - no matter how, or from
where.
However, automacros do NOT run when Word is started using automation.. If
they are in Word's startup directory, though, they will be loaded so the
code as posted is unnecessary - and, as you say, Application.Run can be used
to explicitly run code.
--
Enjoy,
Tony
"Cindy M -WordMVP-" wrote in message
news:VA.0000bb54.005596b4@speedy...
> > I want to run autoexec macro in addins, and call the Add method of the
> > AddIns collection. The addins are loaded, and the Installed property is
> > True. But the autoexec macro in the addins is not run.
> > Why? How to run autoexec macro in addins programmatically?
> >
> AutoExec macros only execute when Word starts, and the Add-ins are
> located in the Startup folder. They do not run when loaded over the
> Addins collection. Nor should you store Addins you intend to load as you
> show in your code in the Startup folder; they should be in a different
> folder.
>
> You can try to use the Application.Run method to run macros in loaded
> Addins.
>
> > I write the code as follows:
> >
> >
> > Dim gwdApp As Word.Application
> > Dim strFileName As String
> >
> > strFileName = Dir(gwdApp.Path & "\STARTUP\")
> > Do While strFileName <> ""
> > gwdApp.AddIns.Add gwdApp.Path & "\STARTUP\" & strFileName, True
> > strFileName = Dir
> > Loop
> > 'User Profile Addins
> > strFileName = Dir(gwdApp.StartupPath & "")
> > Do While strFileName <> ""
> > gwdApp.AddIns.Add gwdApp.StartupPath & "\" & strFileName, True
> > strFileName = Dir
> > Loop
> >
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
> 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 :-)
>
date: Wed, 8 Mar 2006 18:39:03 -0000
author: Tony Jollans My Forename at My Surname dot com
|
|