+ Reply to Thread
Results 1 to 2 of 2

Updating and Cancelling calendar appointments

Hybrid View

michelle 1 Updating and Cancelling... 12-16-2013, 02:27 PM
michelle 1 Re: Updating and Cancelling... 12-18-2013, 05:09 PM
  1. #1
    Forum Contributor
    Join Date
    07-02-2013
    Location
    abbots langley
    MS-Off Ver
    Excel 2010
    Posts
    325

    Updating and Cancelling calendar appointments

    Hi

    I know i am probably pushing my luck a bit and have only got as far as i have as a result of help received from this forum. I offered to help someone out but am struggling with my final piece. I have code to create new appointments and re-occurring appointments in outlook. In order to finish this piece off i am looking to update appointments as well, and if possible identify any conflicting. I have created a userform and the appointment information is transferred to sheet 4 and will always be on line 5 whether it is new or an update. I am desperately trying to learn via books and from any help I am given on here. This is what i have, am I trying to achieve the impossible.???

    
    Public Sub CreateOutlookApptz()
    
    
    Dim olApp As Outlook.Application
    Dim olAppt As Outlook.AppointmentItem
    Dim olNs As Outlook.Namespace
    Dim CalFolder As Outlook.MAPIFolder
    Dim subFolder As Outlook.MAPIFolder
    Dim arrCal As String
    Dim objPattern As Object
    Dim i As Long
    
    
    On Error Resume Next
    Set olApp = Outlook.Application
    If olApp Is Nothing Then
        Set olApp = Outlook.Application
        Err.Clear
    End If
    On Error GoTo Err_Execute
    
    Set olNs = olApp.GetNamespace("MAPI")
    Set CalFolder = olNs.GetDefaultFolder(olFolderCalendar)
    
    i = 5
    Do Until Trim(Cells(i, 3).Value) = ""
        arrCal = Cells(i, 3).Value
        Set subFolder = CalFolder.Folders(arrCal)
        Set olAppt = subFolder.Items.Add(olAppointmentItem)
    
        'MsgBox subFolder, vbOKCancel, "Folder Name"
        With olAppt
            'Define calendar item properties
            Set objPattern = olAppt.GetRecurrencePattern
                With objPattern
                    .RecurrenceType = olRecursWeekly
                    Select Case Weekday(Cells(i, 4).Value)
                        Case 1
                            .DayOfWeekMask = olSunday
                        Case 2
                            .DayOfWeekMask = olMonday
                        Case 3
                            .DayOfWeekMask = olTuesday
                        Case 4
                            .DayOfWeekMask = olWednesday
                        Case 5
                            .DayOfWeekMask = olThursday
                        Case 6
                            .DayOfWeekMask = olFriday
                        Case 7
                            .DayOfWeekMask = olSaturday
                    End Select
                    .Occurrences = Cells(i, 6).Value
                    .Duration = DateDiff("n", Cells(i, 4), Cells(i, 4))
                    .PatternStartDate = Cells(i, 4).Value
                    .StartTime = Cells(i, 5).Value
                End With
            .Subject = Cells(i, 1).Value
            .Location = Cells(i, 8).Value
            .Body = Cells(i, 1).Value & " " & Cells(i, 9).Value
            .BusyStatus = olBusy
                    
            .Categories = Cells(i, 2).Value
            .Save
        End With
    i = i + 1
    Loop
    Set olAppt = Nothing
    Set olApp = Nothing
    Exit Sub
    Err_Execute:
    MsgBox "An error occurred - Exporting items to Calendar."
    
    End Sub
    Really appreciate any help anyone can give

    Michelle
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-02-2013
    Location
    abbots langley
    MS-Off Ver
    Excel 2010
    Posts
    325

    Re: Updating and Cancelling calendar appointments

    I think updating may be the problem therfore as a way round this will cancel the appointment and create new. If someone can help with the code please to cancel. Will post as a new thread.

+ 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 appointments in Non Default Calendar
    By nobox in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-17-2015, 10:21 PM
  2. [SOLVED] Calendar appointments in Outlook via VBA
    By michelle 1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-15-2013, 08:11 AM
  3. Calendar with appointments for mulitple users
    By sammar12 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2007, 10:56 AM
  4. [SOLVED] Appointments from Excel into Outlook Calendar
    By Sh0t2bts in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-09-2006, 11:20 AM
  5. Creating Calendar appointments
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2005, 08:06 PM

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