View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Execute VB code depending on time of day

My preference for that kind of thing would be to use the ontime method. When
the spreadsheet is opened check the time and if it is after 17:00 then enable
the button otherwise disable. Have the on time method enable the button at
17:00. That code is very lightweight. The nice thing about it is that the
user can only click the button when it is valid to do so. No need for a
message box telling the user that they can not do something that you never
intended to let them complete.
--
HTH...

Jim Thomlinson


"WA" wrote:

Hi,

I have the clock (24 format) in a spreadsheet. When a user clicks a button,
I would like to see the procedure executed only if it is after a certain
time. ie. if it is after 17:00, then the function will run, otherwise a msg
will state that it is too early.

I've looked at the OnTime code, but it will not serve my purpose.
Any ideas would be greatly appreciated.

Thanks,

WA