Disable/Enable Macros through code

  • Thread starter Thread starter ibeetb
  • Start date Start date
I have a workbook that runs automatically every night at midnight - it needs
the macros for this. But during the day, when a user oipens the wrkbook, I
want macros disabled -I need to turn them off when the time is greater than
5 AM, for ex. I have the time part down....it is just the code to disable
the macros that I need
 
ibeetb said:
I have a workbook that runs automatically every night at midnight - it
needs the macros for this. But during the day, when a user oipens the
wrkbook, I want macros disabled -I need to turn them off when the time
is greater than 5 AM, for ex. I have the time part down....it is just
the code to disable the macros that I need

Odd design. If this is a workbook in a shared directory that is opened by a
scheduled Excel process at midnight but also available for any user to open
during the day, then there's a better way to update the workbook. Use a
separate workbook to contain the macros. It'd need to open the shared
workbook and be coded so it operates on the shared workbook, but this two
workbook design would ensure that there was no code in the shared workbook
for your users to run by accident.
 
Back
Top