How to Link a Task Item to a Contact (OL2000)

M

Martin

Hi,

im attempting to Link a Task Item to a ContactItem with following code. The
I've placed a Button on a ContactItem and want to create automaticly a Task
whitch is linked to the contact.
My Problem seems to be: how can I get the object from my Contact in the
myContactItem filed?

sub cbCreateTask_click()
Dim objOutlook 'As Outlook.Application
Dim objNamespace 'As Outlook.Namespace
Dim objTaskItem 'As Outlook.TaskItem

set myContactItem = Application.ActiveInspector.CurrentItem

Set objTaskItem = Application.CreateItem(3) 'olTaskItem = 3
Set objNamespace = Application.GetNamespace("MAPI")

With objTaskItem
.Subject = "Test"
.Body= "Test"
.DueDate = now
.StartDate = now
.ReminderSet = True
.ReminderTime = now
.Links.Add myContractItem 'With this commandline i want to link the
Contact to the Task

end with

objTaskItem.Display

Set objOutlook = Nothing
Set objNamespace = Nothing
Set objTaskItem = Nothing
end sub

Thanks in advace for any hint.

Martin
 
S

Sue Mosher [MVP-Outlook]

If this code is running inside your contact, then you don't use
Application.ActiveInspector.CurrentItem. The current item is simply the
intrinsic Item object:

objtaskItem.Links.Add Item
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top