PC Review


Reply
Thread Tools Rate Thread

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

 
 
nouveauricheinvestments@gmail.com
Guest
Posts: n/a
 
      12th Dec 2008
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
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      12th Dec 2008
If macros aren't enabled, then no macro will run -- including the macro that
would check to see if macros are enabled.



(E-Mail Removed) 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
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      12th Dec 2008
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

<(E-Mail Removed)> wrote in message
news:a16ca6de-ea37-4458-aa4e-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      12th Dec 2008
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),
(E-Mail Removed) 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

 
Reply With Quote
 
nouveauricheinvestments@gmail.com
Guest
Posts: n/a
 
      12th Dec 2008
On Dec 12, 12:10 pm, Chip Pearson <c...@cpearson.com> 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),
>
> nouveauricheinvestme...@gmail.com 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.
 
Reply With Quote
 
nouveauricheinvestments@gmail.com
Guest
Posts: n/a
 
      12th Dec 2008
On Dec 12, 12:10 pm, Chip Pearson <c...@cpearson.com> 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),
>
> nouveauricheinvestme...@gmail.com 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
 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      12th Dec 2008


>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),
(E-Mail Removed) wrote:

>On Dec 12, 12:10 pm, Chip Pearson <c...@cpearson.com> 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),
>>
>> nouveauricheinvestme...@gmail.com 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Add-in determine if macros enabled in another workbook? Anthony Berglas Microsoft Excel Programming 3 29th Nov 2008 11:07 PM
how to track changes in a workbook with macros enabled =?Utf-8?B?SmVyanVpY2U=?= Microsoft Excel Misc 0 11th Oct 2006 06:16 PM
how to track changes in a workbook with macros enabled =?Utf-8?B?SmVyanVpY2U=?= Microsoft Excel Misc 0 11th Oct 2006 06:15 PM
Close Workbook if Macros not enabled Graham Fowler Microsoft Excel Programming 2 23rd Sep 2005 11:06 PM
Open workbook-macros enabled, opening another with macros George J Microsoft Excel Programming 5 17th Sep 2004 02:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:32 AM.