View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl[_3_] Steve Yandl[_3_] is offline
external usenet poster
 
Posts: 117
Default VBA to Assign Outlook Task

Jim,

I've done code to synchronize a list of tasks between a workbook and Outlook
but there is so much code that doesn't apply to your specific needs posting
it as is might not be real helpful. I could pull out the pertinent portions
but there are a few things to think about first.

You are probably going to want at least a subject for the task to go along
with the due date. Where is that going to come from?

Outlook tasks have a ".Status" property that will equal "COMPLETED" when the
task is completed. You can check the value of the property from Excel but
you need to think about what event(s) will trigger your subroutine to check.
It isn't practical to continuously monitor for a change in task status but
you could certainly do something like check everytime the workbook is opened
or you could have a button to click that would allow the user to force a
check at any time.

As it turns out, you could have tasks with the same subject. The value of
the task items ".EntryID" property is a unique value for each task. You
will want to designate a cell somewhere to store this value for the outlook
task item you create so your VBA code in the Excel Workbook has a value that
can be used to effectively retrieve the specific task you created when
checking to see if the ".Status" property has become "COMPLETED".

You will want to use IsDate on the value of your cell where the start date
is to avoid errors. At that point, if it's confirmed as a date you simply
subtract 4 and set the Outlook TaskItem's ".DueDate" property to that value.


Steve Yandl



"Jim" wrote in message
...
I'm using Excel Office 2007. I would like a VBA code to create a task in
Outlook based on a date in an Excel workbook. Once the task is completed,
I
would like that completion date entered into the Excel Workbook. Is this
possible?

My initial date is located in the workbook 'Loan Book', worksheet 'Loan
Data' cell CN9. I would like the task completion due date to be four days
prior to the sheet date. Once the task is completed, I would like that
completion date CP9.

Thanks in advance for any advice.