How To Check If The User Has Macros Enabled When The Workbook Opens

  • Thread starter nouveauricheinvestments
  • Start date
N

nouveauricheinvestments

Hi,

I have a workbook project which I will be distributing to a bunch of
execs and I want to write a select case statement to check and see
whether the user has macros enabled when he opens it. What is the
object/method for macros or security or whatever?

Thanks
 
D

Dave Peterson

If macros aren't enabled, then no macro will run -- including the macro that
would check to see if macros are enabled.
 
B

Bob Phillips

There is none per se, but you can do something like this


The standard way to approach this is as follows.
- create a worksheet with a message on explaining that for this workbook to
run it needs macros enabled, maybe even a few screenshots
- hide all other worksheets
- add some code in the Workbook_Open event that un hides the other sheets,
but hides that sheet.

What happens is that if they do not enable macros, they will only see the
warning sheet, telling them how to do it. If they enable macros,it will
start-up the workbook as it should be.
 
C

Chip Pearson

If macros are disabled, you can't run any code that would test that.
If code runs, then, by definition, macros are enabled. If you need the
user to have macros enabled to use the workbook, you can set things up
to that the workbook is unusable if macros are disabled. See
http://www.cpearson.com/Excel/EnableMacros.aspx
and
http://www.cpearson.com/Excel/EnableMacros2.aspx

for details and examples.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Fri, 12 Dec 2008 10:12:55 -0800 (PST),
 
N

nouveauricheinvestments

If macros are disabled, you can't run any code that would test that.
If code runs, then, by definition, macros are enabled. If you need the
user to have macros enabled to use the workbook, you can set things up
to that the workbook is unusable if macros are disabled. Seehttp://www.cpearson.com/Excel/EnableMacros.aspx
andhttp://www.cpearson.com/Excel/EnableMacros2.aspx

for details and examples.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)

Perfect. Thanks for all of your answers. Very Helpful.
 
N

nouveauricheinvestments

If macros are disabled, you can't run any code that would test that.
If code runs, then, by definition, macros are enabled. If you need the
user to have macros enabled to use the workbook, you can set things up
to that the workbook is unusable if macros are disabled. Seehttp://www.cpearson.com/Excel/EnableMacros.aspx
andhttp://www.cpearson.com/Excel/EnableMacros2.aspx

for details and examples.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)

I'm getting a message saying 'Unable to set the visible property of
the worksheet class'. what the heck is that? I have been able to set
it with this statement before...

Sheets("Sheet4").Visible = False
 
C

Chip Pearson

I'm getting a message saying 'Unable to set the visible property of
the worksheet class'. what the heck is that? I have been able to set
it with this statement before...

Sheets("Sheet4").Visible = False

A workbook must always have at least one sheet visible. If you attempt
to hide all the worksheets in a workbook, the code will blow up when
you attempt to hide the last visible sheet.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Fri, 12 Dec 2008 11:51:37 -0800 (PST),
 

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