Hi,
I know this has been covered in other threads but as a newbie to VBA I'm struggling to grasp where I am going wrong by looking at other examples. Any help would be massively appreciated.
I'm trying to get my appointments to go in to a non-default calendar but can't get the code to work:
Sub CreateAppointment()
Set olOutlook = CreateObject("outlook.Application")
Set Namespace = olOutlook.GetNamespace("MAPI")
Set oloFldr = Namespace.GetDefaultFolder(9).Folders("SL Work calendar")
LastRow = Cells(Rows.Count, 33).End(xlUp).Row
For i = 3 To LastRow
Description = Cells(i, 36).Value
StartDate = Cells(i, 33).Value
ReminderDate = Cells(i, 38).Value
ReminderTime = Cells(i, 39).Value
Set Appointment = oloFolder.Items.Add
With Appointment
.Start = StartDate
.Subject = Description
.ReminderDate = ReminderDate
.ReminderTime = ReminderTime
.Save
End With
Next i
End Sub
Where am I going wrong?
My end goal for this script is for a message box to appear on saving the workbook that asks upon closing the workbook: "Have any changes been made?" yes/no answer. If yes then run the script. Any pointers on that would be great.
Thanks in advance and apologies for my ineptitude.
Bookmarks