A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Set appointment time



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old April 9th 09, 02:27 AM posted to microsoft.public.outlook.program_vba
GLHEC-BLS
external usenet poster
 
Posts: 5
Default Set appointment time

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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"GLHEC-BLS" wrote in message
...
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" wrote in message
news 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?






 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set an appointment day but no time (nor all day) Dave Sutton Outlook - Calandaring 1 August 13th 07 07:21 PM
Outlook 2007: appointment with end time before start time PeterA Outlook - Calandaring 0 April 24th 07 12:42 PM
want appointment start time to show in calendar, but not end time Arlene Outlook - Calandaring 0 October 18th 06 03:53 PM
Allow Time Zone Changes Without Changing Calendar Appointment Time TE Outlook - Calandaring 1 June 19th 06 01:42 AM
Daylight Savings Time Changes Appointment Time DCEXEC Outlook - Calandaring 5 April 5th 06 10:31 PM


All times are GMT +1. The time now is 02:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.