PDA

View Full Version : Disable macro while opening word document



anandbabu65
10-17-2011, 01:49 AM
Hi,

I need to disable the macro in the word doc while opening the same through vba code. Is there any code for the same?

anandbabu65
10-17-2011, 10:43 PM
To elaborate,

I need to prevent the warning popup that comes while opening a word with macros. I also need to prevent any auto macros from running while opening the word document. Is there any vb code for the same.

steve_flash
10-20-2011, 08:38 AM
Pop up can be prevented with Macro Security settings but this is a general setting and can't be applied selectively. Could you further describe what are you trying to achieve/prevent during macro execution?

Frosty
10-20-2011, 02:28 PM
WordBasic.DisableAutoMacros 0 '(or 1)
Still works for dealing with autoopen type macros, but warning popups are, as steve indicated, global settings. Where and how to change those settings vary widely depending on Office version, OS and your network architecture (i.e., if you use Group Policies, end-users are local administrators, etc).

If you could easily turn those warnings off via vba code... so could virus programmers.