Press the Disable Macros button with VBA?

D

Dan Williams

When opening a document that contains macros, you get an alert with
these buttons:

Disable Macros

Enable Macros

Can I programmatically open a document as if the "Disable Macros"
button was clicked? I do NOT just want the Auto_Open stuff disabled!

(What I want to open is a document containing objects pasted from a web
site. This document gives me the "Macros" alert even though there are
no explicit VBA macros in it. But I like having the choice, because it
lets me type text in the fields only when "macros" are enabled and it
lets me resize the fields only when "macros" are disabled. I want to
resize them occasionally using VBA, by having it close the document and
re-open it in the disabled mode.)

I'm using Word 2000, Windows 2000

Dan Williams
<danwplanet>
 
J

Jay Freedman

When opening a document that contains macros, you get an alert with
these buttons:

Disable Macros

Enable Macros

Can I programmatically open a document as if the "Disable Macros"
button was clicked? I do NOT just want the Auto_Open stuff disabled!

(What I want to open is a document containing objects pasted from a web
site. This document gives me the "Macros" alert even though there are
no explicit VBA macros in it. But I like having the choice, because it
lets me type text in the fields only when "macros" are enabled and it
lets me resize the fields only when "macros" are disabled. I want to
resize them occasionally using VBA, by having it close the document and
re-open it in the disabled mode.)

I'm using Word 2000, Windows 2000

Dan Williams
<danwplanet>

Hi Dan,

You can't do *anything* programmatically in that dialog. For one
thing, VBA isn't enabled until you press the Enable button, so the
program that you want to "click" with can't be running.

From a wider perspective, if there was some way to programmatically
control that dialog, the hackers would be using it to enable their
scumware in about 2 seconds flat. Don't even think about it. :)
 
C

Cindy M -WordMVP-

Hi Dan,
Can I programmatically open a document as if the "Disable Macros"
button was clicked?
IF you're automating Word 2002 or 2003 then yes, you can use the
Application.AutomationSecurity to set the macro security for
documents you're opening programmatically.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8
2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 
D

Dan Williams

OK, thanks!

Jay, the VBA code I'm running would not be in the document I'm opening.

Dan
 

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