Re: Problems with AutoNew in Normal.dot

Tech-Archive recommends: Fix windows errors by optimizing your registry



Sunny was telling us:
Sunny nous racontait que :

Hi All,

I am getting some frustrating problems with the AutoNew procedure when
I use it inside Normal.Dot. I am using Word 10 (XP).

I have put the following code into a new module in Normal.dot:

Sub AutoNew()
MsgBox "You are in AutoNew"
End Sub

When I open Word I get a new blank document but no code runs in the
AutoNew procedure. If I then open a New Blank Document the code runs
!!!!!!

Does anyone know why the code does not run when I open Word and the
initial document is displayed? (Surely this IS a new blank document?)

More importantly does anyone know HOW to get this code to run when
Word is opened?

AutoNew (now deprecated) and Document_New in the ThisDocument class module
do not run when Word is first launched. The first blank document you get
when you launch Word (Document 1) is not so much a New document as it is a
"default" document that you have no say over its creation.

What are you trying to achieve?
Normally, code in Normal.dot is not really recommended. What kind of code do
you need to execute whenever any document based on Normal.dot is created?

Also, note that documents based on other templates will not benefit form
this code in Normal.dot. If you want to have an impact whenever any document
is created, the route is a little more complicated.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@xxxxxxxxxxxxxxxxxxxxxxx
Word MVP site: http://www.word.mvps.org


.