+ Reply to Thread
Results 1 to 6 of 6

code to delete duplicate calendar entries created from excel spreadsheet

  1. #1
    Registered User
    Join Date
    09-06-2019
    Location
    texas
    MS-Off Ver
    365
    Posts
    3

    code to delete duplicate calendar entries created from excel spreadsheet

    I have this code that I use to create calendar entries from an excel spreadsheet. The code works ok except that it creates dupliacte calendar entries each time its run. Id like to add code that will prevent the duplicates frombeing created if the body of the calendar entry is the same. The body is the only item that will be different in each calendar entry. If someone could help me out that would be greatly appreciated.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: code to delete duplicate calendar entries created from excel spreadsheet

    Hallo chuckm3561
    Welcome to the forum...
    If someone could help me out that would be greatly appreciated.
    This is impossible for anyone in the world to solve due to the following...
    Have no idea what the code is...
    Have no idea what the code does...
    Have no idea how the code is being used...
    Have no idea what your file setup is...

    So...If you can be a little more forthcoming...You might be in luck...
    Also, as this is your first post...Please view the forum rules here
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    09-06-2019
    Location
    texas
    MS-Off Ver
    365
    Posts
    3

    Re: code to delete duplicate calendar entries created from excel spreadsheet

    here is the code....that may help a bit im sure lol.


    Sub add_pending_LOMRS()
    ' adds a list of appontments to the Calendar in Outlook
    Dim olApp As Outlook.Application
    Dim olAppItem As Outlook.AppointmentItem
    Dim r As Long

    On Error Resume Next
    Worksheets("Schedule").Activate

    Set olApp = GetObject("", "Outlook.Application")
    On Error GoTo 0
    If olApp Is Nothing Then
    On Error Resume Next
    Set olApp = CreateObject("Outlook.Application")
    On Error GoTo 0
    If olApp Is Nothing Then
    MsgBox "Outlook is not available!"
    Exit Sub
    End If
    End If
    r = 3 ' first row with appointment data in the active worksheet
    Dim mysub, myStart, myEnd
    While Len(Cells(r, 7).Text) <> 0
    mysub = Cells(1, 1) & ", " & Cells(1, 13)
    myStart = DateValue(Cells(r, 7).Value)
    myEnd = DateValue(Cells(r, 7).Value)
    'DeleteTestAppointments mysub, myStart, myEnd
    Set olAppItem = olApp.CreateItem(olAppointmentItem) ' creates a new appointment
    With olAppItem
    ' set default appointment values
    .Location = Cells(1, 13)
    .Body = ""
    .ReminderSet = True
    .BusyStatus = olFree
    On Error Resume Next
    .Start = myStart
    .End = myEnd
    .Subject = Cells(1, 6) & ", " & .Location
    .Location = Cells(1, 13).Value
    .Body = .Subject & "- " & Cells(r, 6).Value
    .ReminderSet = True
    .ReminderMinutesBeforeStart = 10080
    .BusyStatus = olFree
    .Categories = "Orange Category" ' add this to be able to delete the testappointments
    On Error GoTo 0
    .Save ' saves the new appointment to the default folder
    End With
    r = r + 1
    Wend
    Set olAppItem = Nothing
    Set olApp = Nothing

    MsgBox "PENDING LOMRS SUCCESFULLY ADDED TO CALENDAR !"
    End Sub

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: code to delete duplicate calendar entries created from excel spreadsheet

    Thanks for code...How bout a sample file to work with !!!!

    Also, as this is your first post...Please view the forum rules here
    2. Programming code must be enclosed in code tags to improve readability. (A, Z)
    Please Login or Register  to view this content.
    (or use the # button)

    Unfortunately no one can assist until you adhere...

  5. #5
    Registered User
    Join Date
    09-06-2019
    Location
    texas
    MS-Off Ver
    365
    Posts
    3

    Re: code to delete duplicate calendar entries created from excel spreadsheet

    here you go
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: code to delete duplicate calendar entries created from excel spreadsheet

    Unfortunately not able to assist...Have mentioned forum rules in post 2 & 4
    Go to your first post...Edit...Highlight the code and press the #

    Also...Your uploaded sample file has absolutely nothing to do with your code...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create duplicate spreadsheet of same name, excel to auto delete old sheet
    By russwongg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2018, 03:47 AM
  2. How to delete duplicate entries in excel columns
    By meetvivek72 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-10-2013, 05:34 AM
  3. Replies: 5
    Last Post: 07-19-2012, 02:11 PM
  4. How do I delete duplicate entries in excel?
    By antieal in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-08-2005, 10:40 AM
  5. [SOLVED] How do you prevent duplicate entries in an excel spreadsheet?
    By Kruser in forum Excel General
    Replies: 2
    Last Post: 11-16-2005, 06:20 PM
  6. Duplicate entries in excel spreadsheet
    By Coldsplice in forum Excel General
    Replies: 1
    Last Post: 09-28-2005, 04:05 PM
  7. Replies: 4
    Last Post: 05-14-2005, 03:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1