Consulting

Results 1 to 4 of 4

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

  1. #1

    Question Need help tweaking a VBA code to generate events in Outlook Shared Calendar w/reminde

    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
    Last edited by Aussiebear; 03-15-2022 at 01:04 AM. Reason: Added code tags to supplied code

  2. #2
    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 = True
    to the appointment.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    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.
    Last edited by Aussiebear; 03-15-2022 at 12:04 PM. Reason: Added code tags to supplied code

  4. #4
    That should work - try it.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •