Set appointment time

Status
Not open for further replies.
R

R0xIRUMtQkxT

I have created a macro that schedules an appointment for a follow up based on

the current date and time. The follow up has to be scheduled for the next day

at 8 a.m. I'm not sure about the best way to do that. I can only get it to

except a specific date and time and not a variable date (one dat from the

current date) and a specific time. Here is what I have that schedules a

follow up one day from the current date two hours ahead.

olAppt.Start = Now() + (1#) + (2# / 24#)

But if it is Thursday then I need it to schedule it one day from the current

date at 8 a.m. I've tried something that looks like this, and slight

variations, but it doesn't work. The only part that doesn't work is the

#8:00:00# AM part.

If Weekday(dteNextDate) = 5 Then

olAppt.Start = Now() + (1#) & #8:00:00 AM#

Any suggestions? Is it even possible?
 
Now() returns the current date/time. Date() returns the current date, with a

time of midnight. Use Date() with DateAdd() to return tomorrow's date with a

time of 8 a.m.

DateAdd("h", 8, Date+1)

You're on the right track with Weekday() if you need to adjust for weekends.

Sue Mosher

"GLHEC-BLS" <GLHECBLS> wrote in message

news:DB4E87CE-2AAB-4474-A512-50FA11082953@microsoft.com...
> I have created a macro that schedules an appointment for a follow up based
> on
> the current date and time. The follow up has to be scheduled for the next
> day
> at 8 a.m. I'm not sure about the best way to do that. I can only get it to
> except a specific date and time and not a variable date (one dat from the
> current date) and a specific time. Here is what I have that schedules a
> follow up one day from the current date two hours ahead.

> olAppt.Start = Now() + (1#) + (2# / 24#)

> But if it is Thursday then I need it to schedule it one day from the
> current
> date at 8 a.m. I've tried something that looks like this, and slight
> variations, but it doesn't work. The only part that doesn't work is the
> #8:00:00# AM part.

> If Weekday(dteNextDate) = 5 Then
> olAppt.Start = Now() + (1#) & #8:00:00 AM#

> Any suggestions? Is it even possible?
 
That is awesome! Works great thanks a lot. I can't believe I couldn't find

anything in the help section about Date() or Dateadd(). I still can't. Oh

well, that's what this discussions are for I guess.

Just one more question for my own curiosity. What does the "h" do? It

wouldn't work wihtout it, but I'm not sure what purpose it serves.

P.S. The weekday() works great for skipping weekends if it is Friday. It's

also what I use for the code you helped me with because if it is Thursday I

need to schedule the folow up for the next day (friday) at 8 a.m.

Thanks again!

"Sue Mosher [MVP]" wrote:


> Now() returns the current date/time. Date() returns the current date, with a
> time of midnight. Use Date() with DateAdd() to return tomorrow's date with a
> time of 8 a.m.

> DateAdd("h", 8, Date+1)

> You're on the right track with Weekday() if you need to adjust for weekends.

> > Sue Mosher
> > >

> "GLHEC-BLS" <GLHECBLS> wrote in message
> news:DB4E87CE-2AAB-4474-A512-50FA11082953@microsoft.com...
> >I have created a macro that schedules an appointment for a follow up based
> >on
> > the current date and time. The follow up has to be scheduled for the next
> > day
> > at 8 a.m. I'm not sure about the best way to do that. I can only get it to
> > except a specific date and time and not a variable date (one dat from the
> > current date) and a specific time. Here is what I have that schedules a
> > follow up one day from the current date two hours ahead.
> > olAppt.Start = Now() + (1#) + (2# / 24#)
> > But if it is Thursday then I need it to schedule it one day from the
> > current
> > date at 8 a.m. I've tried something that looks like this, and slight
> > variations, but it doesn't work. The only part that doesn't work is the
> > #8:00:00# AM part.
> > If Weekday(dteNextDate) = 5 Then
> > olAppt.Start = Now() + (1#) & #8:00:00 AM#
> > Any suggestions? Is it even possible?


>
 
The easiest way to access Help in VBA is to put the cursor on the function,

method, or property you're interested in and then press F1. What "h" means

will be spelled out once you look at the Help topic for DateAdd(), but see

if you can figure it out for yourself: What might "h" and 8 have in common

with your desired time?

Sue Mosher

"GLHEC-BLS" <GLHECBLS> wrote in message

news:983ED1A6-B38E-4E7A-A891-B05651A9E61B@microsoft.com...
> That is awesome! Works great thanks a lot. I can't believe I couldn't find
> anything in the help section about Date() or Dateadd(). I still can't. Oh
> well, that's what this discussions are for I guess.

> Just one more question for my own curiosity. What does the "h" do? It
> wouldn't work wihtout it, but I'm not sure what purpose it serves.

> P.S. The weekday() works great for skipping weekends if it is Friday. It's
> also what I use for the code you helped me with because if it is Thursday
> I
> need to schedule the folow up for the next day (friday) at 8 a.m.

> Thanks again!

> "Sue Mosher [MVP]" wrote:
>
> > Now() returns the current date/time. Date() returns the current date,
> > with a
> > time of midnight. Use Date() with DateAdd() to return tomorrow's date
> > with a
> > time of 8 a.m.
>

>> DateAdd("h", 8, Date+1)
>

>> You're on the right track with Weekday() if you need to adjust for
> > weekends.



>

>> "GLHEC-BLS" <GLHECBLS> wrote in message
> > news:DB4E87CE-2AAB-4474-A512-50FA11082953@microsoft.com...
> > >I have created a macro that schedules an appointment for a follow up
> > >based
> > >on
> > > the current date and time. The follow up has to be scheduled for the
> > > next
> > > day
> > > at 8 a.m. I'm not sure about the best way to do that. I can only get it
> > > to
> > > except a specific date and time and not a variable date (one dat from
> > > the
> > > current date) and a specific time. Here is what I have that schedules a
> > > follow up one day from the current date two hours ahead.
> >> > olAppt.Start = Now() + (1#) + (2# / 24#)
> >> > But if it is Thursday then I need it to schedule it one day from the
> > > current
> > > date at 8 a.m. I've tried something that looks like this, and slight
> > > variations, but it doesn't work. The only part that doesn't work is the
> > > #8:00:00# AM part.
> >> > If Weekday(dteNextDate) = 5 Then
> > > olAppt.Start = Now() + (1#) & #8:00:00 AM#
> >> > Any suggestions? Is it even possible?

>

>
>>
 
Yeah, I figured out that 'h" meant hour right after I posted the question.

Sort of felt silly. I did find it in the help section too. I have used

modified versions of it already in other areas as well. I was able to make a

combobox where the user could select the time they wanted to make the

follow-up, which is ten times better than my original idea. Here is what it

looks like, out of context:

ElseIf ComboBox2.Value = "9 a.m." Then

If Weekday(Now) = 6 Then

olAppt.Start = DateAdd("h", 9, Date + 3)

Else: olAppt.Start = DateAdd("h", 9, Date + 1)

End If

Thanks for the tip on the help feature. That should save me some time

searching fro solutions. You have been extremley helpful! Thanks again.

"Sue Mosher [MVP]" wrote:


> The easiest way to access Help in VBA is to put the cursor on the function,
> method, or property you're interested in and then press F1. What "h" means
> will be spelled out once you look at the Help topic for DateAdd(), but see
> if you can figure it out for yourself: What might "h" and 8 have in common
> with your desired time?
> > Sue Mosher
> > >

> "GLHEC-BLS" <GLHECBLS> wrote in message
> news:983ED1A6-B38E-4E7A-A891-B05651A9E61B@microsoft.com...
> > That is awesome! Works great thanks a lot. I can't believe I couldn't find
> > anything in the help section about Date() or Dateadd(). I still can't. Oh
> > well, that's what this discussions are for I guess.
> > Just one more question for my own curiosity. What does the "h" do? It
> > wouldn't work wihtout it, but I'm not sure what purpose it serves.
> > P.S. The weekday() works great for skipping weekends if it is Friday. It's
> > also what I use for the code you helped me with because if it is Thursday
> > I
> > need to schedule the folow up for the next day (friday) at 8 a.m.
> > Thanks again!
> > "Sue Mosher [MVP]" wrote:
> >
> >> Now() returns the current date/time. Date() returns the current date,
> >> with a
> >> time of midnight. Use Date() with DateAdd() to return tomorrow's date
> >> with a
> >> time of 8 a.m.
> >
> >> DateAdd("h", 8, Date+1)
> >
> >> You're on the right track with Weekday() if you need to adjust for
> >> weekends.

>
> >
> >> "GLHEC-BLS" <GLHECBLS> wrote in message
> >> news:DB4E87CE-2AAB-4474-A512-50FA11082953@microsoft.com...
> >> >I have created a macro that schedules an appointment for a follow up
> >> >based
> >> >on
> >> > the current date and time. The follow up has to be scheduled for the
> >> > next
> >> > day
> >> > at 8 a.m. I'm not sure about the best way to do that. I can only get it
> >> > to
> >> > except a specific date and time and not a variable date (one dat from
> >> > the
> >> > current date) and a specific time. Here is what I have that schedules a
> >> > follow up one day from the current date two hours ahead.
> >> >> > olAppt.Start = Now() + (1#) + (2# / 24#)
> >> >> > But if it is Thursday then I need it to schedule it one day from the
> >> > current
> >> > date at 8 a.m. I've tried something that looks like this, and slight
> >> > variations, but it doesn't work. The only part that doesn't work is the
> >> > #8:00:00# AM part.
> >> >> > If Weekday(dteNextDate) = 5 Then
> >> > olAppt.Start = Now() + (1#) & #8:00:00 AM#
> >> >> > Any suggestions? Is it even possible?
> >
> >
> >>


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Appointment-Cannot set Categories because ConversationID is not set Outlook VBA and Custom Forms 1
C Set reminder / appointment by right clicking email Using Outlook 1
S how to set user properties to a newly created appointment Outlook VBA and Custom Forms 12
A iCloud add-on for Outlook: Reminder for new appointment is set to 'None' by default. How to change? Using Outlook 6
T Outlook makes every appointment recurring and set to the current date/time Using Outlook 2
J Set calendar default to 'none' (policy) Exchange Server Administration 3
U When opening shared Calendar "The set of folders cannot be opened" Using Outlook 0
L Help: set flag for sent mail to check if received an answer Outlook VBA and Custom Forms 2
D VBA - unable to set rule condition 'on this computer only' Outlook VBA and Custom Forms 5
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
O Cannot expand the folder. The set of folders cannot be opened. You do not have permission to log on. Using Outlook 1
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
bmtjedi Set objApp = Application Not Working in O365-32bit Using Outlook 1
F how do i set a reminder in onenote 2010 Using Outlook 8
glnz How set up new IMAP on Outlook-Office 365 and merge in pst from Outlook 2003 for same two email accounts? Using Outlook 5
ChrisK2 Send email to advertise@slipstick.com fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
S How to set up button in ribbon for individual Quick Steps Using Outlook 1
J Set Timer/Countdown on Emails? Outlook VBA and Custom Forms 3
N How to set automatically the default or user defined Quickstyle Templates by Answer in Outlook Using Outlook 1
Victor_50 Set all subfolders to not autoarchive Outlook VBA and Custom Forms 11
Z Script to set account? Using Outlook 0
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Can you set reminder to specific times? Using Outlook 7
CWM030 I do not see a way to set the personal archive folder Exchange Server Administration 2
Witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
O Set columns for all (sub)folders Using Outlook 8
Fozzie Bear Correct Method to set up Outlook.com accounts as Exchange Using Outlook.com accounts in Outlook 7
e_a_g_l_e_p_i How to set fonts for emails in all folders in Outlook Using Outlook 1
F Set (flagged) reminder for next business day Using Outlook 4
L how to set downloaded cached emails Using Outlook 5
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
S set a flag task date as the next weekday Outlook VBA and Custom Forms 4
Diane Poremsky Set Another Data File as Default When Using an Exchange Account Using Outlook 0
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
L set task reminder date to same as start date (without affecting due date) Using Outlook 0
C Outlook VBA to set current account Outlook VBA and Custom Forms 1
Diane Poremsky Add Attachments and Set Email Fields During a Mail Merge Using Outlook 0
O How to set subject line in replies using VBA Outlook VBA and Custom Forms 1
A Custom form not showing when recurrence is set for a meeting Using Outlook 0
M Exchange 2013 On premise set MessageRateLimit for User has no effect. Exchange Server Administration 0
A Block user to send emails to specific set of email ids Using Outlook 1
D Outlook 2007 e-mail header- How to set font & font size in received message headers ? Using Outlook 2
Diane Poremsky Exchange account set-up missing in Outlook 2016 Using Outlook 0
M To set the storage folder for an outgoing Outlook message Outlook VBA and Custom Forms 8
E Meeting reminders are set for the recipient Exchange Server Administration 9

Similar threads

Back
Top