将Excel数据导入Outlook约会时忽略先前导入的数据

时间:2019-03-28 12:52:07

标签: excel vba outlook

当单元格包含单词“是”时,我有一些代码可以从Excel导入数据。我想包含代码以在再次运行代码时忽略先前已导入的所有条目。

Sub Permits()

    Dim OL As Outlook.Application, Appoint As Outlook.AppointmentItem, ES As Worksheet, _
    r As Long, i As Long, WB As ThisWorkbook

    Set WB = ThisWorkbook
    Set ES = WB.Sheets("Permits")
    r = ES.Cells(Rows.Count, 1).End(xlUp).Row
    Set OL = New Outlook.Application
For i = 2 To r



    If ES.Cells(i, 10) = "Yes" Then
    Set Appoint = OL.CreateItem(olAppointmentItem)
    With Appoint
        .Subject = ES.Cells(i, 3).Value
        .Start = ES.Cells(i, 7) + ES.Cells(i, 8).Value
        .ReminderSet = True
        .ReminderMinutesBeforeStart = 60
        .Body = "£" & ES.Cells(i, 6).Value
        .Save
    End With
    End If
Next i
 Set OL = Nothing

End Sub

1 个答案:

答案 0 :(得分:0)

您可以用绿色标记处理过的行,例如: (编辑为要求,它将在单元格11中查找“是”)

$ (document) .ready (function () {
    $ ('# comment_form'). submit ((e) =>
        e.preventDefault ();
        <! - console.log ("You have clicked on the comment input button") ->
        var $ form = $ (this);
        console.log ("$ form:", $ form)
        var url = $ form.attr ('action');
        console.log ("url (request to save comment):", url);
    }}
});

您还可以创建一个单独的列来标记它们等,然后根据需要进行编辑。另外,您可以使电子表格保持“干净”并搜索具有相同数据的现有提醒。