View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Héctor Miguel Héctor Miguel is offline
external usenet poster
 
Posts: 434
Default Determining if the user enabled macros

hi, Samuel !

How can it be determined whether or not a user enabled macros?
The workbook I created has a lot of code that validates data input and
I do not want anyone to change the information unless the macros are enabled. Any ideas?


one (wild) idea (you need to protect your vba-project):
since you need to restrict the use *only* to macros enabled...

- use the '_beforeclose' event to:
- set the workbook property "IsAddin" to true
- save the workbook
- close the workbook

- use the '_open" event to set its property "IsAddin" to false

pros: your workbook will be *operational* ONLY if macros are enabled
cons: *IF* the user does not enable the macros... (probably) will have to restart excel -?-

hth,
hector.