Goody61865
Board Regular
- Joined
- Mar 4, 2011
- Messages
- 50
I have a code that updates a calender event with a due date and it works great. My problem is I dont know how to assign the event to another email address, it only updates the calender of the person entering the dates. Is there a way to update another users calender?
Here is my code:
Sub Update_Calender(FormulaCell As Range)
Dim objOL As Object
Dim objItem As Object
Dim lngRow As Long
Set objOL = CreateObject("Outlook.Application")
lngRow = 4
Dim oSheet As Worksheet
Set oSheet = ThisWorkbook.Worksheets("GanttChart")
If oSheet.Cells(lngRow, 2).Text <> "" Then
Set objItem = objOL.CreateItem(1) ' constant olAppointmentItem = 1
With objItem
.Body = oSheet.Cells(FormulaCell.Row, "B").Value & vbNewLine & vbNewLine & _
"Your task is due : " & oSheet.Cells(FormulaCell.Row, "A").Value & _
vbNewLine & vbNewLine & "Please update your task"
.Duration = 60
.Start = oSheet.Cells(FormulaCell.Row, "D").Value & " 9:00:00 AM"
.Subject = oSheet.Range("B4").Value
.ReminderMinutesBeforeStart = "30"
.Save
End With
End If
lngRow = lngRow + 1
Set objItem = Nothing
Set objOL = Nothing
'MsgBox "Your due date for this task has been added to your calender"
End Sub
Here is my code:
Sub Update_Calender(FormulaCell As Range)
Dim objOL As Object
Dim objItem As Object
Dim lngRow As Long
Set objOL = CreateObject("Outlook.Application")
lngRow = 4
Dim oSheet As Worksheet
Set oSheet = ThisWorkbook.Worksheets("GanttChart")
If oSheet.Cells(lngRow, 2).Text <> "" Then
Set objItem = objOL.CreateItem(1) ' constant olAppointmentItem = 1
With objItem
.Body = oSheet.Cells(FormulaCell.Row, "B").Value & vbNewLine & vbNewLine & _
"Your task is due : " & oSheet.Cells(FormulaCell.Row, "A").Value & _
vbNewLine & vbNewLine & "Please update your task"
.Duration = 60
.Start = oSheet.Cells(FormulaCell.Row, "D").Value & " 9:00:00 AM"
.Subject = oSheet.Range("B4").Value
.ReminderMinutesBeforeStart = "30"
.Save
End With
End If
lngRow = lngRow + 1
Set objItem = Nothing
Set objOL = Nothing
'MsgBox "Your due date for this task has been added to your calender"
End Sub