View Single Post
 
Old 07-09-2011, 05:32 AM
Joe Patrick Joe Patrick is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default How do you update existing Outlook calendar item from Word with macro?

Hello!

I have this macro that adds an item to OL:

Private Sub CommandButton1_Click() 'add to OL calendar

Dim objOL As Object
Dim objItem As Object
Set objOL = CreateObject("Outlook.Application")

Set objItem = objOL.CreateItem(1)

With objItem
.Body = ActiveDocument.TextBox10.Value
.Duration = 60
.Start = ActiveDocument.TextBox19.Value & " " & ActiveDocument.TextBox20.Value
.Subject = ActiveDocument.TextBox1.Value & " " & ActiveDocument.TextBox30.Value
.ReminderMinutesBeforeStart = 10080
.Save
End With
Set objItem = Nothing
Set objOL = Nothing
MsgBox "Item has been added to your Outlook Calendar"
End Sub

TextBox30 is constant, everything else might change. I'd like, when the button is clicked:

1. Check the OL calendar for an item that has ActiveDocument.TextBox30.Value in the subject
2. If yes, update that item with the new date/time/info
3. If no, create the new item

Is this possible? If not, I'd settle for at least finding the existing item so I can put a msgbox that it already exists so update it manually/exit sub.

Thank you!
Reply With Quote