Solved

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

Posted on 2014-03-23
2
414 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

627 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