template question/normal.dot/autonew macro 
Author Message
 template question/normal.dot/autonew macro

I have an autonew macro in the normal.dot template which I use as the
"standard" template for all Word documents. In the autonew macro I have some
routines that should be executed every time I create a new document based on
the standard template (i.e. when I click on the new button in Word).

If I (or someone else) uses *another* template I don't want the autonew
macro in the normal.dot template to be executed. Some helpful person told me
that I could use "If ActiveDocument.AttachedTemplate =
Templates("Normal.dot") Then...".

And it works fine, almost everywhere... I have set the location to the
normal.dot in Tools, Options, File Locations, User Templates and it works
fine on my machine with Word XP and I have also tried it on other machines
with Word 2000 and Word 97 and it works fine there too. But the problem is
that on *some* machines (which seems to have Word 97) this solution doesn't
work. It doesn't matter what kind of template the user selects, the autonew
macro in the normal.dot template is executed no matter what. It seems that
it on some occations doesn't care abut the "If
ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then...".
statement...?

Any ideas anyone? Any input appreciated.

/g



Tue, 05 Apr 2005 04:14:06 GMT  
 template question/normal.dot/autonew macro
Hi garbo,

In your routine, place the following to find out what template that Word
thinks is attached:

If ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then
    MsgBox ActiveDocument.AttachedTemplate
Else
'    do nothing
End If

It sounds like this is evaluating to true all the time in your 97
environment (and this modification will test that).

HTH


Quote:
> I have an autonew macro in the normal.dot template which I use as the
> "standard" template for all Word documents. In the autonew macro I have
some
> routines that should be executed every time I create a new document based
on
> the standard template (i.e. when I click on the new button in Word).

> If I (or someone else) uses *another* template I don't want the autonew
> macro in the normal.dot template to be executed. Some helpful person told
me
> that I could use "If ActiveDocument.AttachedTemplate =
> Templates("Normal.dot") Then...".

> And it works fine, almost everywhere... I have set the location to the
> normal.dot in Tools, Options, File Locations, User Templates and it works
> fine on my machine with Word XP and I have also tried it on other machines
> with Word 2000 and Word 97 and it works fine there too. But the problem is
> that on *some* machines (which seems to have Word 97) this solution
doesn't
> work. It doesn't matter what kind of template the user selects, the
autonew
> macro in the normal.dot template is executed no matter what. It seems that
> it on some occations doesn't care abut the "If
> ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then...".
> statement...?

> Any ideas anyone? Any input appreciated.

> /g



Tue, 05 Apr 2005 04:30:09 GMT  
 template question/normal.dot/autonew macro
Hello!

Okie, and if that is the case...any work arounds?

/g



Quote:
> Hi garbo,

> In your routine, place the following to find out what template that Word
> thinks is attached:

> If ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then
>     MsgBox ActiveDocument.AttachedTemplate
> Else
> '    do nothing
> End If

> It sounds like this is evaluating to true all the time in your 97
> environment (and this modification will test that).

> HTH



> > I have an autonew macro in the normal.dot template which I use as the
> > "standard" template for all Word documents. In the autonew macro I have
> some
> > routines that should be executed every time I create a new document
based
> on
> > the standard template (i.e. when I click on the new button in Word).

> > If I (or someone else) uses *another* template I don't want the autonew
> > macro in the normal.dot template to be executed. Some helpful person
told
> me
> > that I could use "If ActiveDocument.AttachedTemplate =
> > Templates("Normal.dot") Then...".

> > And it works fine, almost everywhere... I have set the location to the
> > normal.dot in Tools, Options, File Locations, User Templates and it
works
> > fine on my machine with Word XP and I have also tried it on other
machines
> > with Word 2000 and Word 97 and it works fine there too. But the problem
is
> > that on *some* machines (which seems to have Word 97) this solution
> doesn't
> > work. It doesn't matter what kind of template the user selects, the
> autonew
> > macro in the normal.dot template is executed no matter what. It seems
that
> > it on some occations doesn't care abut the "If
> > ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then...".
> > statement...?

> > Any ideas anyone? Any input appreciated.

> > /g



Tue, 05 Apr 2005 14:59:50 GMT  
 template question/normal.dot/autonew macro
uh oh...I checked in the computer...it thinks it has another template
attached, but *still* executes the code below "If
ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then..."

star trek?

/g



Quote:
> Hi garbo,

> In your routine, place the following to find out what template that Word
> thinks is attached:

> If ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then
>     MsgBox ActiveDocument.AttachedTemplate
> Else
> '    do nothing
> End If

> It sounds like this is evaluating to true all the time in your 97
> environment (and this modification will test that).

> HTH



> > I have an autonew macro in the normal.dot template which I use as the
> > "standard" template for all Word documents. In the autonew macro I have
> some
> > routines that should be executed every time I create a new document
based
> on
> > the standard template (i.e. when I click on the new button in Word).

> > If I (or someone else) uses *another* template I don't want the autonew
> > macro in the normal.dot template to be executed. Some helpful person
told
> me
> > that I could use "If ActiveDocument.AttachedTemplate =
> > Templates("Normal.dot") Then...".

> > And it works fine, almost everywhere... I have set the location to the
> > normal.dot in Tools, Options, File Locations, User Templates and it
works
> > fine on my machine with Word XP and I have also tried it on other
machines
> > with Word 2000 and Word 97 and it works fine there too. But the problem
is
> > that on *some* machines (which seems to have Word 97) this solution
> doesn't
> > work. It doesn't matter what kind of template the user selects, the
> autonew
> > macro in the normal.dot template is executed no matter what. It seems
that
> > it on some occations doesn't care abut the "If
> > ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then...".
> > statement...?

> > Any ideas anyone? Any input appreciated.

> > /g



Tue, 05 Apr 2005 16:01:57 GMT  
 template question/normal.dot/autonew macro
Hi Garbo,

What's the result of
If ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then
    MsgBox ActiveDocument.AttachedTemplate & vbCrLf & _
        Templates("Normal.dot")
End If

Does the msgbox have a path for either one? Or do you get
Normal.dot
OtherTemplate.dot


Quote:
> uh oh...I checked in the computer...it thinks it has another template
> attached, but *still* executes the code below "If
> ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then..."

> star trek?

> /g



> > Hi garbo,

> > In your routine, place the following to find out what template that Word
> > thinks is attached:

> > If ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then
> >     MsgBox ActiveDocument.AttachedTemplate
> > Else
> > '    do nothing
> > End If

> > It sounds like this is evaluating to true all the time in your 97
> > environment (and this modification will test that).

> > HTH



> > > I have an autonew macro in the normal.dot template which I use as the
> > > "standard" template for all Word documents. In the autonew macro I
have
> > some
> > > routines that should be executed every time I create a new document
> based
> > on
> > > the standard template (i.e. when I click on the new button in Word).

> > > If I (or someone else) uses *another* template I don't want the
autonew
> > > macro in the normal.dot template to be executed. Some helpful person
> told
> > me
> > > that I could use "If ActiveDocument.AttachedTemplate =
> > > Templates("Normal.dot") Then...".

> > > And it works fine, almost everywhere... I have set the location to the
> > > normal.dot in Tools, Options, File Locations, User Templates and it
> works
> > > fine on my machine with Word XP and I have also tried it on other
> machines
> > > with Word 2000 and Word 97 and it works fine there too. But the
problem
> is
> > > that on *some* machines (which seems to have Word 97) this solution
> > doesn't
> > > work. It doesn't matter what kind of template the user selects, the
> > autonew
> > > macro in the normal.dot template is executed no matter what. It seems
> that
> > > it on some occations doesn't care abut the "If
> > > ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then...".
> > > statement...?

> > > Any ideas anyone? Any input appreciated.

> > > /g



Tue, 05 Apr 2005 20:34:54 GMT  
 template question/normal.dot/autonew macro
Hi Dave!

Good question! We did another workaround, we put the code in the procedure
Document_New() under ThisDocument for Normal.dot. Then it works, but I still
would like to find out why it didn't when we used AutoNew?

/g

Quote:
> What's the result of
> If ActiveDocument.AttachedTemplate = Templates("Normal.dot") Then
>     MsgBox ActiveDocument.AttachedTemplate & vbCrLf & _
>         Templates("Normal.dot")
> End If

> Does the msgbox have a path for either one? Or do you get
> Normal.dot
> OtherTemplate.dot



Fri, 08 Apr 2005 17:24:59 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. template question/normal.dot/autonew macro

2. macros in templates other than normal.dot

3. Default File New based on template other than normal.dot

4. Separate template vs. normal.dot

5. Can Normal.dot be changed to another template?

6. Copying Styles from a Global template to normal.dot

7. Normal.dot template & AutoText

8. Password Protected Macro in Normal.dot

9. Execute macro in normal.dot

10. Execute Macro in normal.dot

11. copying macros to a new normal.dot

12. How do I store a macro somewhere other than normal.dot

 

 
Powered by phpBB® Forum Software