Solved

Duplicate Outlook 2007 "New Task For Contact" Functionality In VBA

Posted on 2014-03-23
2
403 Views
Last Modified: 2014-03-24
When a user right-clicks a Contact in Outlook 2007, then clicks "Create," they can click the option of "Create New Task For Contact" to create a new task for the Contact.  This is VERY convenient because in addition to creating the new Task, the Task is also automatically linked to the Contact (see bottom left corner of the new Task to the right of the "Contacts ..." button).

I need to create this functionality using VBA.  In addition to this functionality I also need to set the value for several of the new Task's fields using the same VBA code (e.g., Subject, Start Date, etc.).  I am an experienced Excel VBA user and I understand the object model fairly well.  Does anyone have any ideas how I might code this functionality?

Thanks,

Bill Vallance
0
Comment
Question by:bvallanc
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39949863
Hi,

pls try

Sub Test()
Dim objOutlook As New Outlook.Application
Dim objTask As Outlook.TaskItem
Set objTask = objOutlook.Session.GetDefaultFolder(olFolderTasks).Items.Add

objTask.Recipients.Add "FirstName LastName"
objTask.ContactNames = "ContactName"
objTask.Subject = "Subj"
objTask.Body = "Test Body"
objTask.DueDate = Now() + 1
objTask.Assign
objTask.Send
objTask.Close olSave
End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:bvallanc
ID: 39950815
Perfect!  Thanks Rgonzo1971 for the quick response.  This worked perfectly.

Bill Vallance
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Set OWA language and time zone in Exchange for individuals, all users or per database.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now