ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How To Check If The User Has Macros Enabled When The Workbook Opens (https://www.excelbanter.com/excel-programming/421245-how-check-if-user-has-macros-enabled-when-workbook-opens.html)

[email protected]

How To Check If The User Has Macros Enabled When The Workbook Opens
 
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

Dave Peterson

How To Check If The User Has Macros Enabled When The Workbook Opens
 
If macros aren't enabled, then no macro will run -- including the macro that
would check to see if macros are enabled.



wrote:

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


--

Dave Peterson

Bob Phillips[_3_]

How To Check If The User Has Macros Enabled When The Workbook Opens
 
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.


--
__________________________________
HTH

Bob

wrote in message
...
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




royUK[_93_]

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

You can't use code to check if a user has macros enabled, it won't run!

Most methods use hide all pages except a warning page on closing. When
the workbook is opened this page will be visible if macros are not
enabled. If macros are enabled code in the open event unhides the other
pages & hdes the warning

See 'Excel Help: How to make a user enable Excel macros'
(http://tinyurl.com/5n4yyd)


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=40314


Chip Pearson

How To Check If The User Has Macros Enabled When The Workbook Opens
 
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),
wrote:

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


[email protected]

How To Check If The User Has Macros Enabled When The WorkbookOpens
 
On Dec 12, 12:10 pm, Chip Pearson wrote:
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)

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

wrote:
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


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

[email protected]

How To Check If The User Has Macros Enabled When The WorkbookOpens
 
On Dec 12, 12:10 pm, Chip Pearson wrote:
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)

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

wrote:
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


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

Chip Pearson

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


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),
wrote:

On Dec 12, 12:10 pm, Chip Pearson wrote:
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)

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

wrote:
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


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



All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com