Outlook VBScript: Sub CreateNewAppointment()

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Outlook VBScript: Sub CreateNewAppointment()

Post by armsys » Sun Apr 20, 2008 8:53 am

Is the following code valid under MS VBScript environment?

Sub CreateNewAppointment()
Dim olApp As Outlook.Application
Dim olNewMeeting As Outlook.AppointmentItem
Set olApplication = GetObject("","Outlook.Application")
Set olns = olApplication.GetNamespace("MAPI")
Set olApp = New Outlook.Application
Set olNewMeeting = olApp.Creation(olAppointmentItem)
With olNewMeeting
.Recipients.Add "Marcus"
.Start = XXXXXXXXXXXXXXXXX
.Duration = 10
.Importance = olImportanceHigh
.Subject = "Macro Scheduler"
.Save
End With
End Sub

BTW, how could I assign the current date and time to olNewMeeting.Start?
Thanks in advance.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Apr 24, 2008 8:53 am

Yes, I believe that should work - did you get this from scripts 'n tips? There's something similar there. You can supply a date/time to .Start. See the following page for details of the format required:
http://www.microsoft.com/technet/script ... s0405.mspx
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts