Excel to outlook without repeating tasks

Closed
Excel to set tasks in outlook - Jan 20, 2010 at 02:17 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 11, 2010 at 08:34 AM
Hello,

I am having a small problem. I want to use excel to update the tasks in outlook. All I have is a due date (from A2) and a task (from B2) Here is the code I have got so far

Code:
Sub UpdateTasks()


Dim olApp As Outlook.Application
Dim blnCreated As Boolean
Dim arrTasks() As Variant, I As Long
arrTasks = Range("A2", Cells(Rows.Count, "B").End(xlUp)).Value
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then
Set olApp = CreateObject("Outlook.Application")
blnCreated = True
Err.Clear
Else
blnCreated = False
End If
On Error GoTo 0
For I = LBound(arrTasks) To UBound(arrTasks)
With olApp.CreateItem(olTaskItem)
.DueDate = arrTasks(i, 1)
.Subject = arrTasks(i, 2)
.Save
' .Close
End With
Next I
If blnCreated = True Then
olApp.Quit
End If
End Sub

Which is all working well. However, it doesn't recognize if a task already exists then don't re-enter it. Every time the Macro is ran, it is doing all the tasks over again, instead of just adding the new tasks.

I hope that make sense and im sure its an easy fix but im not a programming wiz. any help would be great as I need this asap

many thanks
Related:

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 11, 2010 at 08:34 AM
See this

http://www.codeforexcelandoutlook.com/blog/2008/08/export-outlook-tasks-to-excel/
1
Might be a little bit backwards, but probably easiest to have Excel run a script first that has Outlook export its existing tasks to Outlook. Then have Excel de-dupe the tasks and send the new ones back to Outlook. I'm quite the programming newbie myself, so have no idea / code handy on how to get Outlook to send it's task list to Excel.
0