outlook entry via vb script
Jeg fandt følgende stump kode på nettet til at importere events i min kalender. Problemet er bare at koden duplerer entries ifald jeg kører den 2 gange. Er der en der har en smart måde hvorledes jeg kan checke for en entry inden jeg sætter den ind?Dim olkApp, olkCalendar, olkEvent, arrEvents, arrItem, varEvent
BuildEventList
Set olkApp = CreateObject("Outlook.Application")
Set olkCalendar = olkApp.GetNamespace("MAPI").GetDefaultFolder(9)
For Each varEvent in arrEvents
arrItem = Split(varEvent, ":")
Set olkEvent = olkApp.CreateItem(1)
olkEvent.Subject = arrItem(0)
olkEvent.Start = arrItem(1)
olkEvent.Body = arrItem(2)
olkEvent.AllDayEvent = True
olkEvent.ReminderSet = False
olkEvent.Display
olkEvent.Save
Next
Set olkEvent = Nothing
Set olkCalendar = Nothing
Set olkApp = Nothing
WScript.Echo "Events Added"
Sub BuildEventList()
'Change 6 to the number of events in your list -1
ReDim arrEvents(5)
'Add a line like the following for each event. Arrays start at 0 not 1. The events can be in
any order.
arrEvents(0) = "Project A Starts:11/2/2007:Description"
arrEvents(1) = "Project B Starts:11/3/2007:Description"
arrEvents(2) = "Project C Starts:11/4/2007:Description"
arrEvents(3) = "Project A Ends:11/5/2007:Description"
arrEvents(4) = "Project B Ends:11/6/2007:Description"
arrEvents(5) = "Project C Ends:11/7/2007:Description"
End Sub