Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - determining whether macros have been enabled?

Status
Not open for further replies.

llgonzo

Programmer
Mar 31, 2003
2
US
I have an Excel worksheet with a command button on it that provides additional features in the worksheet. My users need to be able to see the worksheet regardless of whether macros have been disabled or not. However, if the user has disabled macros, I need to disable the button. Does anyone know how to programatically determine whether the user has disabled macros?
 
You can handle this in Workbook_BeforeClose event (set enabled property of the button to false and save workbook) and Workbook_Open event (enabled=true).

combo
 
Okay...so which property of the application or workbook should I use to determine if the user has enabled macros so that I know whether or not to enable the button in the workbook_open event?
 
It will be automatic - closed workbook always has command button disabled. If the user disable macros while opening, Workbook_Open procedure will not be executed and button enabled.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top