ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run macro automatically (https://www.excelbanter.com/excel-programming/300668-run-macro-automatically.html)

nightshift12[_2_]

run macro automatically
 
what i am trying to do is set up a booby trap with an excel workbook s
that the critical worksheet will disappear when a macro is run. i hav
created the macro to accomplish this. what i need to know if there is
way using the date function and an "if" statement to have the macro ru
automatically when the condition is met.

eg: if today()20 june o4, then run the macro


is this possible, or is there another way to accomplish this. ideally
would like to have the option of changing the condition such a
entering a later date. this is for a program i designed on my own fo
work, but do not want others to be able to access it in certai
situations. hence the booby trap.

Pete

--
Message posted from http://www.ExcelForum.com


Vasant Nanavati

run macro automatically
 
There is no way to make this foolproof, as the user can easily disable
macros. But you can certainly put the macro in the Workbook_Open event:

If Date DateValue("20-Jun-2004") Then ...

I don't think it's advisable to set booby traps for other users, though.

--

Vasant

"nightshift12 " wrote in
message ...
what i am trying to do is set up a booby trap with an excel workbook so
that the critical worksheet will disappear when a macro is run. i have
created the macro to accomplish this. what i need to know if there is a
way using the date function and an "if" statement to have the macro run
automatically when the condition is met.

eg: if today()20 june o4, then run the macro


is this possible, or is there another way to accomplish this. ideally i
would like to have the option of changing the condition such as
entering a later date. this is for a program i designed on my own for
work, but do not want others to be able to access it in certain
situations. hence the booby trap.

Peter


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com