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 / July 2007

Tip: Looking for answers? Try searching our database.

something went wrong on my earlier post

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
richardconers@yahoo.com - 15 Jul 2007 04:39 GMT
something went wrong on my earlier post about AutoExec, so I'm
repeating it.  I've using Word XP and I'm trying to initialize the
application object that is in a class module.  When I manually run the
initialization procedure, everything is fine.  But I can't get
AutoExec to execute.  So I ran some variations on AutoExec and nothing
worked.

Here's what I've tried to test making an AutoExec work:

In a regular module in the Normal template, I've got a module named
"AutoExec"  and a procedure called Main:

Public Function Main()
MsgBox "autoexec works"
End Function

it didn't work.

I deleted that "AutoExec" module and then in another regular module  I
have this code:

Public Function autoexec()
MsgBox "autoexec works"
End Function

it didn't work.

Then i tried a startup switch in the Run menu of Windows :
"C:\Program Files\Microsoft Office\Office10\WINWORD.EXE/mautoexec"

It didn't work.  I got an error saying that Windows couldn't find the
path.

Anything else I can try????
Thanks!!!!!!
old man - 15 Jul 2007 05:36 GMT
Hi,

The autoexec macro has to be in a template that is automatically loaded. You
probably put the autoexec in a normal.dot that is not the normal that is
being used by Word. I created a template with a msgbox, saved it as a
template (.dot) type file in the startup folder (which is defined by the
Tools --> Options --> File Locations and is the one defined in the Startup on
the bottom of the list.)  Its not a good practice to put anything in the
Normal.Dot template. Following is a paragraph I cut from the Auto Macros Help
text in Word VBA:

The only exception is the AutoExec macro, which will not run automatically
unless it is stored in one of the following: the Normal template, a template
that is loaded globally through the Templates and Add-Ins dialog box, or a
global template stored in the folder specified as the Startup folder.

old man

> something went wrong on my earlier post about AutoExec, so I'm
> repeating it.  I've using Word XP and I'm trying to initialize the
[quoted text clipped - 31 lines]
> Anything else I can try????
> Thanks!!!!!!
Russ - 15 Jul 2007 07:45 GMT
http://support.microsoft.com/kb/210565
http://wordprocessing.about.com/od/customizingword/qt/AutoExecMacro.htm

You need a space between ....exe /(switch)
Also the link above says autoexec won't run from a command line start.

> something went wrong on my earlier post about AutoExec, so I'm
> repeating it.  I've using Word XP and I'm trying to initialize the
[quoted text clipped - 31 lines]
> Anything else I can try????
> Thanks!!!!!!

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Ed - 15 Jul 2007 17:58 GMT
Hi Richard,

When I've done it in the past, I've always named the *macro* AutoExec, not
the module.

This link might be of use:

http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm

One other thing, as far as I know, AutoExec macros don't run when Word is
started by Automation. Probably not relevant to you but worth being aware of.

Regards.

Ed

> something went wrong on my earlier post about AutoExec, so I'm
> repeating it.  I've using Word XP and I'm trying to initialize the
[quoted text clipped - 31 lines]
> Anything else I can try????
> 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.