Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Disable Macros in workbook programmatically

Does anyone know how to programmatically disable macros as though the user
clicked the "Disable Macros" button on the security warning dialog?

If so, could you please post example code.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Disable Macros in workbook programmatically

You can not toggle the macro security settings programmatically in any way...
You however are the first person on the forum wanting to disable them... I
think you should get a gold star for that. This question comes up all the
time trying to enable macros.

You could however write some code that validates the user with some kind of
a login. Getting the password right would set a global boolean that is
checked immediately prior to any code executing. No password... No
execution...

HTH

"quartz" wrote:

Does anyone know how to programmatically disable macros as though the user
clicked the "Disable Macros" button on the security warning dialog?

If so, could you please post example code.

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Disable Macros in workbook programmatically

Thanks again Jim.

Actually, my code is validating to a certain file location. I'm trapping if
the file has been moved because then other programs won't function correctly.
Have had a problem with people emailing the file itself rather than the link
to the file.

I guess I could have code to delete the code modules...but do you know
whether the "Trust access to visual basic project" check box setting goes
with the file or whether that is set on each user's machine?

"Jim Thomlinson" wrote:

You can not toggle the macro security settings programmatically in any way...
You however are the first person on the forum wanting to disable them... I
think you should get a gold star for that. This question comes up all the
time trying to enable macros.

You could however write some code that validates the user with some kind of
a login. Getting the password right would set a global boolean that is
checked immediately prior to any code executing. No password... No
execution...

HTH

"quartz" wrote:

Does anyone know how to programmatically disable macros as though the user
clicked the "Disable Macros" button on the security warning dialog?

If so, could you please post example code.

Thanks in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable macros on a programmatically opening .xls file Matt[_2_] Excel Discussion (Misc queries) 2 May 25th 07 04:45 AM
Disable or remove macros for a workbook to be sent in email... [email protected] Excel Programming 3 January 13th 05 03:31 PM
How do I turn off macros when programmatically opening a workbook. PhilBerkhof Excel Programming 3 December 10th 04 09:55 PM
Disable Macros when opening workbook Rob[_21_] Excel Programming 7 November 12th 04 09:22 AM
How to disable autoopen() programmatically Karl Steinam Excel Programming 2 September 30th 04 06:35 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"