Hi Guys
I'm what you would call an VBA novice, and thus in need of your help. I need a piece of code that will export appointments (shifts) from excel into my Outlook calendar. So far, I've managed to write something that exports what I need, but I can't work out how to schedule it to the correct start and end times. The piece of code I have so far just places the shifts at 00:00 because i haven't defined start and end time because I don't know how.
The code I have is:
Option Explicit
Sub CalendarExport()
Dim oOL As Outlook.Application, oAppoint As Outlook.AppointmentItem
Dim oWS As Worksheet, r As Long, i As Long, sStart As String
Set oWS = Sheet1
r = oWS.Range("A1").CurrentRegion.Rows.Count
Set oOL = New Outlook.Application
For i = 2 To r
Set oAppoint = oOL.CreateItem(olAppointmentItem)
With oAppoint
sStart = oWS.Cells(i, 2)
sStart = Left(sStart, Len(sStart) - 4) & Year(Date)
.Start = CD(sStart)
.Subject = oWS.Cells(i, 1)
.Location = "Power Ops"
.MeetingStatus = olNonMeeting
.ReminderSet = True
.Save
End With
Next i
Set oOL = Nothing
End Sub
Help of any kind would greatly be appreciated. I have attached the workbook as an example of what I'm trying to accomplish.
Bookmarks