Kainic
02-06-2013, 08:44 PM
Hi,
I'm trying to create an event on calendar and invite multiple people to it from an excel sheet. I'm succesful with a single person, using strTo but I'm having problems with strCC with multiple users.
Here's the code I'm using:
Sub PromoOutlk()
Dim olApp As Outlook.Application
Dim objapp As Outlook.AppointmentItem
Set olApp = New Outlook.Application
Set objapp = olApp.CreateItem(olAppointmentItem)
strSubj = Sheets("BBDD").Range("A2").Value
strBody = Sheets("BBDD").Range("B2").Value
strTo = Sheets("BBDD").Range("C2").Value
intStatus = Sheets("BBDD").Range("D2").Value
dtFecha = Sheets("BBDD").Range("E2").Value
dtTime = Sheets("BBDD").Range("F2").Value
strAlarm = Sheets("BBDD").Range("G2").Value
intDurAlarm = Sheets("BBDD").Range("H2").Value
With objapp
.Subject = strSubj
.Body = strBody
.RequiredAttendees = strTo
.BusyStatus = intStatus
.Start = dtFecha + dtTime
.ReminderSet = False
.MeetingStatus = olMeeting
If strAlarm = "Si" Then
.ReminderMinutesBeforeStart = intDurAlarm
.ReminderSet = True
End If
.Display
.Send
.Save
End With
Set objapp = Nothing
Set olApp = Nothing
End Sub
My idea is to have 2 fixed CCs (mail1@whatever.com and mail2@whatever.com) and 1 To (refered to a cell).
Hope you can help.
Thanks in advance.
Sergi
I'm trying to create an event on calendar and invite multiple people to it from an excel sheet. I'm succesful with a single person, using strTo but I'm having problems with strCC with multiple users.
Here's the code I'm using:
Sub PromoOutlk()
Dim olApp As Outlook.Application
Dim objapp As Outlook.AppointmentItem
Set olApp = New Outlook.Application
Set objapp = olApp.CreateItem(olAppointmentItem)
strSubj = Sheets("BBDD").Range("A2").Value
strBody = Sheets("BBDD").Range("B2").Value
strTo = Sheets("BBDD").Range("C2").Value
intStatus = Sheets("BBDD").Range("D2").Value
dtFecha = Sheets("BBDD").Range("E2").Value
dtTime = Sheets("BBDD").Range("F2").Value
strAlarm = Sheets("BBDD").Range("G2").Value
intDurAlarm = Sheets("BBDD").Range("H2").Value
With objapp
.Subject = strSubj
.Body = strBody
.RequiredAttendees = strTo
.BusyStatus = intStatus
.Start = dtFecha + dtTime
.ReminderSet = False
.MeetingStatus = olMeeting
If strAlarm = "Si" Then
.ReminderMinutesBeforeStart = intDurAlarm
.ReminderSet = True
End If
.Display
.Send
.Save
End With
Set objapp = Nothing
Set olApp = Nothing
End Sub
My idea is to have 2 fixed CCs (mail1@whatever.com and mail2@whatever.com) and 1 To (refered to a cell).
Hope you can help.
Thanks in advance.
Sergi