locked
Outlook use VBA to delete appointment RRS feed

  • General discussion

  • I have a appointment list stored in excel. I used the VBA to add the appointment in outlook based on excel. Now I want to use the VBA to delete the apppointment based on excel.

    Question 1#:  I have no idea about how to wirte the VBA code ? Please help me~~~

    Below is the code I used to add the appointment based on excel~~~

    Sub AddToOutlookAppointment()
        Dim olApp As Object
        Dim myApp As Object 'Outlook.App

        On Error Resume Next
        Set olApp = GetObject(, "Outlook.Application")
        If Err.Number = 429 Then
            Set olApp = CreateObject("Outlook.Application")
        End If

        Dim i As Long
        For i = 8 To 10 Step 1  
            If Range("C" & i).Value <> "" Then
                Set myApp = olApp.CreateItem(1)
                myApp.Subject = Range("A" & i).Value
                myApp.Start = Range("C" & i).Value
                'myApp.StartDate = Range("C" & i).Value 
                myApp.Save
            End If
        Next
        Set olApp = Nothing
        Set myApp = Nothing
        Set tzEastern = Nothing
    End Sub

    But I am still confused between "myApp.Start = Range("C" & i).Value"  and " myApp.StartDate = Range("C" & i).Value ".

    Question 2#:   If I use the "myApp.Start = Range("C" & i).Value", the appointment can be added to the right date, but when i use the " myApp.StartDate = Range("C" & i).Value ", the appointment only can be added to the System Date. I do not know why this happen. Please help me. 

    Thanks very much~~~~

    Wednesday, February 19, 2014 8:27 AM