I am sending this request a second time, because although I had a response from JimmyPena, the solution did not work, and I seem to be unable to add my comments on what happened. The VBA code is in an Excel spreadsheet, not in Outlook.
I am trying to write some VB code in Excel 2007 that will automatically send meeting invitations from Outlook 2007 Calendar to the list of recipients listed in the Excel spreadsheet at the times indicated in the spreadsheet. This is useful because I can send hundreds of meeting requests to different people on different dates with the click of a button. I can do this by sending the following code from my user account:
' Create the Outlook session Set myoutlook = CreateObject("Outlook.Application") ' Create the AppointmentItem Set myapt = myoutlook.CreateItem(olAppointmentItem) ' Set the appointment properties With myapt .Subject = " Assessment Centre " .Location = "conference room A" .Start = Cells(5, 24 + j) & " 17:00:00 PM" .Duration = 120 .Recipients.Add Cells(i, 1).Value .MeetingStatus = olMeeting ' not necessary if recipients are email addresses 'myapt.Recipients.ResolveAll .AllDayEvent = "False" .BusyStatus = "2" .ReminderSet = False .Body = L1 & vbCrLf & vbCrLf & L2 & vbCrLf & vbCrLf & L3 & vbCrLf & vbCrLf & L4 .Save .send End With
But now I want to send a meeting request from a dummy user account for which I am a delegate, using something like sendonbehalfof, so that all meeting requests are stored in the dummy calendar, and other delegates can also manage the system using the same dummy user account This works great when sending emails with the following code:
Set oApp = CreateObject("Outlook.Application") Set oMail = oApp.CreateItem(0) With oMail .To = " John.Smith@John _Smith.com " .Subject = "Subject" .Body = "Body" .SentOnBehalfOfName = " Fred.bloggs@fred _blogs.com" .send End With
A letter from me will be on behalf of Fred Bloggs
But I can’t get it to work with calendars.
Ive searched high and low with the words “meeting”, “meeting request”, sendonbehalfof, etc., and it looks like you should be able to do this for meetings using sendusingaccount, but this doesn't seem to work (this will not work, just ignores the instruction and sends the user from my account as before).
Can someone tell me how to do this? , Thank you very much.