aspiringnerd
New Member
- Joined
- Apr 22, 2022
- Messages
- 39
- Office Version
- 365
- Platform
- Windows
I'm trying to create an outlook event where it uses the selected row values for start, end, subject, etc but I cannot figure out the syntax. Most of the tutorials I've found create a loop but Id like to just step through each row for now
VBA Code:
Sub NewEvent()
Set olOutlook = CreateObject("Outlook.Application")
Set Namespace = olOutlook.GetNameSpace("MAPI")
Set oloFolder =NameSpace.GetDefaultFolder(9)
I = Rows(ActiveCell.Row).Select
StartDate = Cells(I, 20).value
EndDate = Cells(I, 21).value
Cat = Cells(I, 22).value
Description = Cells(I, 23).value
Set Appointment = oloFolder.items.add
With Appointment
.Start = StartDate
.End = Endate
.Subject = Description
.Categories = Cat
.save
end with
End Sub