Create appointment skipping weekends and within a timeframe

  • Thread starter Thread starter GLHEC-BLS
  • Start date Start date
G

GLHEC-BLS

I am using Outlook 2003. I am writing a macro and part of what it is suppose
to do is set up an appointment one day and two hours from the "Now" time. The
thing I can't figure out is how to get the appointment to skip weekends and
only set the time within the timeframe of 11 a.m. to 8 p.m. Here is what I
have that will make the appointment one day and two hours from now. Any help
is greatly appreciated!

' Set start time for one day and two hours from now...
olAppt.Start = Now() + (1#) + (2# / 24#)
 
You can use the Weekday() function. Supply it with a date and if desired the
optional argument for first day of the week. It will return an Integer value
where Sunday = 1 and Saturday = 7. From that you can tell what day of the
week your calculated date falls on and adjust the date if needed.
 
Back
Top