PDA

View Full Version : Need help tweaking a VBA code to generate events in Outlook Shared Calendar w/reminde



Cali-Newbie
03-14-2022, 09:36 PM
Hi everybody,
I'm not a coder by any means. I've got my hands on a set of VBA coding lines that creates events in Outlook from an Excel spreadsheet. It's almost perfect and is what I need, except I would like for it to do 2 specific things for me and I was hoping expert folks here can help me get it done. Here's the code:



Sub CreateAppointment ()
Set olOutlook = CreateObject ("Outlook.Application")
Set Namespace = olOutlook.GetNameSpace ("MAPI")
Set oloFolder = Namespace.GetDefaultFolder (9)
LastRow = Cells (Rows.Count, 1) .End (xlUp) .Row
For i = 2 To LastRow
Description = Cells(i, 1) .Value
StartDate = Cells (i, 4) .Value
Set Appointment = oloFolder.itmes.Add
With Appointment
.Start = StartDate
.Subject = Description
.save
End With
Next i
End Sub



However I need to tweak it to do 2 specific things for me:

1. To generate events in a shared Outlook calendar (instead of the default one) that I'm going to share
with a team of 5-6 people.
2. To include a reminder which pops up on the shared Outlook calendar on the due date and would be
visible to all team members with whom the calendar is shared.

Thank you

gmayor
03-14-2022, 11:06 PM
If the folder is in the same account then

Set olFolder = Namespace.GetDefaultFolder(9).Parent.Folders("FolderName")where FolderName is the name of the shared calendar.
If you want to set a reminder then add
.ReminderSet = Trueto the appointment.

Cali-Newbie
03-15-2022, 09:02 AM
Thank you so much. I believe this is what I exactly needed. Just to make sure, does the ".ReminderSet = True" goes here in the lines of code?


With Appointment
.Start = StartDate
.Subject = Description
.ReminderSet = True <----- is this the right position?
Save
End With

Appreciate your help.

gmayor
03-15-2022, 09:50 PM
That should work - try it.