PDA

View Full Version : How do I view disabled macros?



duluter
10-27-2009, 07:11 AM
Hi, all.

I have a .doc and Word is giving me the warning that the file contains macros. I know that this file should not have macros in it, so something is fishy. If I tell Word to disable the macros in the file, then it does not let me view any of the macro code in the file. In other words, when I go to the VBA IDE, there is no code in the ThisDocument module for the file in question (and no other modules appear). How do you get Word to let you see the disabled macro code? I Googled it but didn't see anything useful.

Here's another little bit of weirdness. Generally I work in Word 2003, but I also have access to Word 2007. So I tried opening up the .doc file in 2007, saving as a .docx, which should not be allowed to contain macros, then saved that file back to a .doc. When I open the resulting .doc, Word still tells me that there is a macro in the file! What is going on?


Thanks,

D.

fumei
10-27-2009, 11:35 AM
Could be a few things. Is there any code in the template that created the document?

duluter
10-27-2009, 12:15 PM
Thanks for the reply, fumei:

No--there is no code in the template.

I do have an update though:
I asked my coworker to open the doc on her machine, and she doesn't get any message from Word about macros, and she also does not see any code in the IDE. I asked a second coworker, using a completely different Office install on his local machine and he also saw nothing and got no warning.

I might just chalk this one up to halloween. Something weird is going on when I work with the file, but it acts OK for everyone else. What really baffles me is that I get the same macro warning when I open the doc on my work machine via Remote Desktop and when I open the doc on my local machine using my own install of Word. But nothing for anyone else! Arghh.

Anyway, I would still like to know how to view macro code in docs that have had macros disabled. How do I do this? To test, I created a new doc, added a little macro, saved, closed, reopened, said Disable Macros when Word asked me, then tried to view the macro in the IDE and there's nothing there. Why does Word hide the macro code when macros are disabled? How else would someone go about inspecting suspicious code?

D.

lucas
10-27-2009, 12:50 PM
Something is wrong duluter, you should be able to see the code, even after telling it not to enable them.

You should make sure which document you are looking at the code in.

In the project explorer on the left, make sure it's not normal or some other addin that might also be open......

duluter
10-27-2009, 01:21 PM
Lucas:

I'm actually relieved to know that this is not the default behavior, so thank you for pointing that out.

Still, something is wrong, as you said. I made sure to look in the correct document in the IDE--when I open it in Disabled mode, no code visible; when I open it in Enabled mode, the code is visible. It's confusing but true. I can't seem to find anyone else with this problem on Google.

D.

macropod
10-27-2009, 06:05 PM
Hi duluter,

If your document has any Active-X controls (eg radio buttons) or even an empty code module, you'll get the macro warning.

Your co-workers might noit get the warning if their systems are set up with a lower macro security level than your's.

fumei
10-29-2009, 12:26 PM
Well supposedly there are no modules, but it is true just the existence of ActiveX controls can set off macro warnings. I wish I could test for this situation, but - believe it or not - I can not set Security to High, or even Medium. It is set for Low by policy. Even if I manually set it to High (or medium) it immediately re-sets it to Low.

duluter
10-30-2009, 07:57 AM
Macropod:

I see now that when I open the document in Word 2003 and choose to disable macros when the warning box pops up, the Control Toolbox is open, undocked, and it is set to design mode. But there do not appear to be any Active-X controls in the doc. Strange thing is even if I turn design mode off, close the toolbox, and save the doc, when I reopen it is back in design mode with the toolbox open again. Is there a way for me to see whether there are any Active-X controls in the doc that I'm not seeing?


Fumei: Isn't a security setting of Low a strange company policy?

D.

macropod
10-30-2009, 03:49 PM
Hi duluter,

You may need to turn Design Mode off from either the Controls Toolbox toolbar or the Web Tools toolbar.

Have you tried switching to 'Normal' or 'Draft' view to check for Active-X controls?

Paul_Hossler
10-31-2009, 08:23 AM
Another thing to try is to copy and paste into new document and see if the problem goes with it.

Can you post the doc?

Paul

fumei
11-03-2009, 09:45 AM
Yes, having Security permanently set to Low is a bit unusual, but that is the way they have it set up.