vbafasttrack
New Member
- Joined
- Sep 13, 2012
- Messages
- 2
Hi,
I am trying to get meeting invites sent from Outllok via Excel vba. THe below code works fine (albeit with the usual warnings) with an 'open' visible instance of Outlook present (i.e. when I have previously opened Outlook manually then subsequently run the code) but NOT when Outlook was not opened previously:
Seems to work if the display method is used when there was no previous 'open' Outlook instance. Any ideas ?
Thanks in advance.
I am trying to get meeting invites sent from Outllok via Excel vba. THe below code works fine (albeit with the usual warnings) with an 'open' visible instance of Outlook present (i.e. when I have previously opened Outlook manually then subsequently run the code) but NOT when Outlook was not opened previously:
Code:
'// At this point, we have an oOutlook Appointment object and can now set some of its properties...
With olAppointment
.MeetingStatus = 1 'olMeeting=1, olMeetingCanceled=5
.Start = Sheets("Sheet1").Range("startdatetime").Value
.End = .Start + TimeValue("02:00:00")
'.Duration = "00:05"
.Subject = "Client Quote Appointment 3"
.Location = "TBA"
.Body = Msg
.BusyStatus = 2 'olBusy
.ReminderMinutesBeforeStart = 2880
.ReminderSet = True
.Mileage = 22
.Recipients.Add "email@address.com"
.Recipients.ResolveAll
'.Display
'.Save
.Send
End With
Seems to work if the display method is used when there was no previous 'open' Outlook instance. Any ideas ?
Thanks in advance.