How To Find A Macro -- Word 2007



Our company has several hundred controlled forms that are saved as protected
templates on a server.

Recently, we've had many cases of people trying to open these templates and
getting error messages about macros (Do you want to enable?) even though
there shouldn't be any macros in the forms that are giving the errors.

I know very little (read "less than nothing") about macros. How do you find
and disable an unwanted macro in a document? Where do they hide?

I don't know if it matters, but all of the forms that give these errors have
been recently revised. Our document control department has migrated from
Office 2003 to Office 2007 recently, but since most of the company is still
using 2003, we're saving everything in the older formats. All the documents
have the *.dot extension -- not the *.dotm extension.

Thanks for your help.




Doug Robbins - Word MVP

Your users should not be opening the templates. Rather, they should be
using File>New and then selecting the appropriate template as the basis for
the document that they want to create.

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via


You may be right, but that doesn't answer my question of how to find out
whether a document has an unwanted macro in it.

Does anybody out there know how to tell whether there's a macro in a
document or know where to find it?

Jay Freedman

First, let's distinguish between a *document* and a *template*, because that
distinction is critical to Word itself, and using the words interchangeably
is just going to lead us around in circles. According to your original post,
the files you're dealing with are templates, not documents.

Am I correct that the templates (*.dot files) should not contain macros? Is
it also true that they don't (shouldn't) contain any ActiveX controls
(things from the Control Toolbox of Word 2003 or the bottom rows of the
Legacy Controls dropdown in Word 2007)?

If both of those assumptions are true, but you see macro warnings when you
open the templates for editing, then the three main possibilities are:

(a) There really is a macro or an ActiveX control in the template.

(b) Someone in the past added (or recorded) a macro, or inserted an ActiveX
control, and then deleted it; but the file still contains some binary data
that tells Word that the code was once there.

(c) The aforementioned binary data was placed in the file erroneously when
Word 2007 saved the template in Word 2003 format. (This seems unlikely, but
it's still possible.)

If (a) is true, after opening the template you should be able to see a macro
in the macro editor (in the Project Explorer pane of the editor,
double-click each module icon under the template's project name); if there
is code there, right-click the module and choose to remove it. Also, you can
look through the text of the template for any ActiveX control and remove it.

If (b) or (c) is true, the macro warning is the only visible sign of it.

In the bad old days, the only way to cure a lingering macro warning was to
save the template (or document) was to save it in a format that has no way
to store macros, such as RTF; then open that file and resave it in the *.dot
(or *.doc) format. With Word 2007, it should be possible to save the
template in *.dotx format to strip out the macro-related garbage, then open
that and resave it in *.dot format.

Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.




You can right click on the ribbon and select Customize Quick Access
Toolbar... then click on Popular and select Show Developer tab in the Ribbon
then click OK

Click Developer then click Macros

This will display any macros currently associated with the open document

If you want everyone to not be bothered with macros you can click the Office
Button; select Word Options; go to Trust Center; click Trust Center Settings;
select Disable all macros without notification

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