PPRuNe Forums - View Single Post - Excel cell date to Outlook
View Single Post
Old 26th Mar 2007, 08:52
  #6 (permalink)  
ExGrunt
 
Join Date: Mar 2003
Location: England
Posts: 286
Likes: 0
Received 0 Likes on 0 Posts
Hi ces,

The non trivial bit, which I have not included, is the selection of the data for the variables. The code has to select data from each column, then check that there is not already an appointment with the same details. Equally there is the issue of how to handle changes in the data. If you are not careful you will end up with dozens of duplicate appointments. To write all the code needed is quite a lot of work. All this can be is a pointer in the right direction.

Bearing in mind the above, the bit you are missing is to assign a value in a column to the appropriate variable. So for a simple example, if you have a worksheet called Data with an appointment in row A, with date in A1, subject in A2 and delay in A3 then the code would be:

Sub CreateAppt()
Dim objOL As Outlook.Application
Dim objAppt As Outlook.AppointmentItem

MyDate = Worksheets("Data").Range("A1").Value
MySubject = Worksheets("Data").Range("A2").Value
MyDelay = Worksheets("Data").Range("A3").Value


Set objOL = CreateObject("Outlook.Application")
Set objAppt = objOL.CreateItem(olAppointmentItem)
With objAppt
.Subject = MySubject
.ReminderSet = True
.Start = MyDate
.AllDayEvent = True
.ReminderSet = True
.ReminderMinutesBeforeStart = MyDelay
.Save
End With


Set objOL = Nothing
Set objAppt = Nothing
End Sub
ExGrunt is offline