I have a macro where I enter a date for a job. I also need to enter the day that we have to prepare for the job and the day we have to wrap up from it.
Basically it is a user prompt for the date, then I would like the macro to store the previous business day as a variable, the following business day as a variable, then paste both later on.
I have read a lot about ICUDate, but I don't see anything to take a specified date and turn it into a day of the week. I figure if I can get the day of the week, I can just add one day until it doesn't equal Sat or Sun. Have searched the forums and haven't seen anyone come up with something for this yet. Any pointers?
You want to use ICUDateTimeFor
and the EEE
or EEEE
format to get the day of the week. Something like this to work backward for the prep day:

You can do the same thing for the wrap day, except for that you add a day's worth of seconds (24*60*60
) instead of subtract it.
Something simple like this doesn't take into account holidays. For that, I'd switch to a scripting language that has some sort of holidays library. Python does, and I'm sure JavaScript, Perl, and Ruby do, too.
Thanks a lot! Good note about the Holidays as I'm sure that will bite me eventually. Pretty new to keyboard macro, so going to get that issue when I feel a little more confident. Appreciate this simple solution.