Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

AutoExec not firing in Global template

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DataDay - 07 Oct 2005 17:36 GMT
I am starting Word from an external application and it is intentionally not
visible, but the code in the AutoExec sub of one of my global startup
templates is not firing.  How can I make it fire?

Thanks
Jonathan West - 07 Oct 2005 18:32 GMT
I suspect the problem is that you have Word set as the Outlook email editor,
and you have an email editing window open when you start Word proper.

The only workaround I know of is for any of the macros called by toolbar
buttons or menu items you have with your addin to check whether AutoExec has
already run (the AutoExec routine can set a flag to indicate it has run),
and to run it if it hasn't already.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

>I am starting Word from an external application and it is intentionally not
> visible, but the code in the AutoExec sub of one of my global startup
> templates is not firing.  How can I make it fire?
>
> Thanks
DataDay - 07 Oct 2005 19:30 GMT
Hello Jonathan,

Thanks for responding.  Actually we are not using Word as out email editor.

I'll investigate the toolbar option you mention.

Please let me know if you think of any other reasons why this may be
happening.

Thanks

> I suspect the problem is that you have Word set as the Outlook email editor,
> and you have an email editing window open when you start Word proper.
[quoted text clipped - 9 lines]
> >
> > Thanks
Tony Jollans - 07 Oct 2005 20:25 GMT
I think this is by design. AutoExec macros are suppressed when Word is
started via Automation.

--
Enjoy,
Tony

> Hello Jonathan,
>
[quoted text clipped - 27 lines]
> > >
> > > Thanks
Marc Adams [marcmyword.com] - 07 Oct 2005 21:54 GMT
Perhaps you can have your external application call your autoexec code. You
will need a public handle to the code, but that's pretty simple. It should be
relatively straightforward to do so.

something like (very rough)
dim appWord as word.application
appWord.getobject() [again no thought with this, I'm assuming you have a
handle already]
appWord.Application.Run "publicroutinethatcallsautoexec"

Maybe that may work.

Signature

Please visit my new site: www.marcmyword.com. I'd love your input as to how
to make it great.

> I think this is by design. AutoExec macros are suppressed when Word is
> started via Automation.
[quoted text clipped - 39 lines]
> > > >
> > > > Thanks
DataDay - 07 Oct 2005 22:04 GMT
Thanks for all your suggestions.  I was advised elsewhere to use the AutoOpen
sub instead as it will run when Word is opened automation client.

http://support.microsoft.com/?kbid=286310

> I am starting Word from an external application and it is intentionally not
> visible, but the code in the AutoExec sub of one of my global startup
> templates is not firing.  How can I make it fire?
>
> Thanks
Tony Jollans - 07 Oct 2005 22:29 GMT
AutoOpen macros are not suppressed by Automation, that is true,

But  .. AutoOpen macros don't fire in global templates (they are not
'opened')

--
Enjoy,
Tony

> Thanks for all your suggestions.  I was advised elsewhere to use the AutoOpen
> sub instead as it will run when Word is opened automation client.
[quoted text clipped - 6 lines]
> >
> > Thanks
DataDay - 07 Oct 2005 23:46 GMT
Tony, you are so right.

Marc, I went with your solution and it seems to be working, I've got to test
it a little more, but that seems to be the ticket.

Thank you both so much.

> AutoOpen macros are not suppressed by Automation, that is true,
>
[quoted text clipped - 17 lines]
> > >
> > > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.