Word 2003 Macro Disappears in Word 2007

T

turtlehand

Hello,

Why would a Word 2003 AutoOpen Macro disappear when I open the file in
Word 2007?

I've written a macro named AutoOpen which updates some embedded fields
on the document whenever the file is opened. It works fine in Word
2003. When I open the same file in Word 2007, the macro is gone! If I
use Word 2003 to re-open the file, the macro is visible and works.

I'm really bewildered by this, does anyone have insight?

Thanks,

Joe
 
L

Lene Fredborg

My guess is that the macro is stored in your Normal.dot (used by Word 2003)
and not in the document in question. Word 2007 has its own Normal.dotm
template and has no connection to Normal.dot. If that is the problem, you can
find and copy the macro in Normal.dot (2003) and insert it into Normal.dotm
(2007).

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
L

Lene Fredborg

(Note: Somehow your first and second post have been split into two separate
threads here - the below is a reply to your second post which cannot
currently be seen in this thread - I posted the same reply in the second
thread...)

Yes, the dot and dotm answer applies. Normal.dot(m) is something special.

In Word 2003 and earlier, you can store macros in documents (.doc) and
templates (.dot).
In files in Word 2007-format, you can store macros in macro-enabled files
only, i.e. .docm (documents) and .dotm (templates) – the file formats .docx
and .dotm cannot contain macros.

However, if you open a .doc document in Word 2007 and if that document
contains macros, the macros will remain in the document as long as you save
it in .doc-format (referred to as “Word 97-2003 documents (*.doc)†in the
Save As dialog box). But depending on your macro security settings, an
AutoOpen macro may not automatically run when you open the document. If your
macro security setting is set to the highest level and if the document is not
stored in a “trusted locationâ€, the macros are disabled. There are four
different levels. If “Disable all macros with notification†is selected, you
should see a security warning just below the Ribbon when you open the
document – you can click the button next to the warning and allow Word to
activate the macros.

In Word 2007, security settings are found here: Office button > Word Options
Trust Center category > click the Trust Center settings button.

I suggest you do this:
In Word 2003, check whether your macro is stored in Normal.dot or in the
document in question. You can, for example, do this as follows:
Press Alt+F8 to open the Macros dialog box. In the “Macos in†field, select
your document. If the macro is now shown in the list, it is found in the
document. If the list is empty, the macro is not found in the document. In
the “Macros in†list, you can now try to select “Normal.dot (global
template)â€. Can you now see the macro? If yes, it is stored in Normal.dot.
You can select it in the list, click “Edit†to open the Visual Basic Editor
(VBE) where you will see the macro. You can then, for example, copy the macro
and paste it into Normal.dotm (the 2007 Normal template).

If the macro is found in the document and if the macro security setting is
preventing it from running, you can either change the security setting (do
not set it the fourth option…). Alternatively, move the macro to e.g.
Normal.dotm. All macros found in Normal.dotm will be available to all
documents in Word 2007.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
T

turtlehand

(Note: Somehow your first and second post have been split into two separate
threads here - the below is a reply to your second post which cannot
currently be seen in this thread - I posted the same reply in the second
thread...)

Yes, the dot and dotm answer applies. Normal.dot(m) is something special.

In Word 2003 and earlier, you can store macros in documents (.doc) and
templates (.dot).
In files in Word 2007-format, you can store macros in macro-enabled files
only, i.e. .docm (documents) and .dotm (templates) – the file formats .docx
and .dotm cannot contain macros.

However, if you open a .doc document in Word 2007 and if that document
contains macros, the macros will remain in the document as long as you save
it in .doc-format (referred to as “Word 97-2003 documents (*.doc)” inthe
Save As dialog box). But depending on your macro security settings, an
AutoOpen macro may not automatically run when you open the document. If your
macro security setting is set to the highest level and if the document isnot
stored in a “trusted location”, the macros are disabled. There are four
different levels. If “Disable all macros with notification” is selected, you
should see a security warning just below the Ribbon when you open the
document – you can click the button next to the warning and allow Word to
activate the macros.

In Word 2007, security settings are found here: Office button > Word Options


I suggest you do this:
In Word 2003, check whether your macro is stored in Normal.dot or in the
document in question. You can, for example, do this as follows:
Press Alt+F8 to open the Macros dialog box. In the “Macos in” field, select
your document. If the macro is now shown in the list, it is found in the
document. If the list is empty, the macro is not found in the document. In
the “Macros in” list, you can now try to select “Normal.dot (global
template)”. Can you now see the macro? If yes, it is stored in Normal.dot.
You can select it in the list, click “Edit” to open the Visual Basic Editor
(VBE) where you will see the macro. You can then, for example, copy the macro
and paste it into Normal.dotm (the 2007 Normal template).

If the macro is found in the document and if the macro security setting is
preventing it from running, you can either change the security setting (do
not set it the fourth option…). Alternatively, move the macro to e.g.
Normal.dotm. All macros found in Normal.dotm will be available to all
documents in Word 2007.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmarkwww.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word

Lene,

Thanks for the education. I will be back at the customer site on
Tuesday and will test out what you have explained.

Enjoy your day,

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top