add an address to a recurring task from a linked conatct

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I add an address to a recurring task that is linked to a contact from
the same contact. In task view area you can set the view to see contact name
start date, due date and address. I would like to add that address from
contacts automatic without manually adding it
 
so if I add this to the VBA within Outlook th address will be linked
Dim WithEvents m_colCalItems As Outlook.Items

Private Sub Application_Startup()
Dim objNS As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set m_colCalItems = objNS.GetDefaultFolder(olFolderCalendar).Items
Set objNS = Nothing
End Sub

Private Sub m_colCalItems_ItemAdd(ByVal Item As Object)
Dim objContact As Outlook.ContactItem
Dim strAccount As String
If Item.Links.Count = 1 Then
Set objContact = Item.Links(1).Item
strAccount = objContact.Account
If strAccount <> "" Then
Item.BillingInformation = strAccount
Item.Save
End If
End If
Set objContact = Nothing
End Sub


Private Sub m_colCalItems_ItemChange(ByVal Item As Object)
Dim objContact As Outlook.ContactItem
Dim strAccount As String
Select Case Item.Links.Count
Case 1
Set objContact = Item.Links(1).Item
strAccount = objContact.Account
If strAccount <> Item.BillingInformation Then
Item.BillingInformation = strAccount
Item.Save
End If
Case 0
If Item.BillingInformation <> "" Then
Item.BillingInformation = ""
Item.Save
End If
End Select
Set objContact = Nothing
End Sub
 
The code you posted shows the basic technique, but it handles the Account
property from the account and puts it in the BillingInformation field of the
task. You'll need to modify it for your application after you decide which
ContactItem address property you want to use and what task property you want
to store it in. When in doubt about property names, check the object
browser: Press ALt+F11 to open the VBA environment in Outlook, then press
F2. Switch from <All Libraries> to Outlook to browse all Outlook objects and
their properties, methods, and events. Select any object or member, then
press F1 to see its Help topic.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Mrs. Mosher, Thank you for taking the time to respond to my inquiry.
Although I understand the principle, I am unable to apply it, do to what I
may feel is my lack of understanding of VBA code. Would you be interested in
allowing me to pay you a nominal fee to write this code? I would allow you to
connect to my laptop to write this. Let me know Please, you may e-mail me at
(e-mail address removed) Thanks again
 
No, I have more than enough projects on my plate and am more interested in
helping people learn to write their own code than doing that work for them.
If you want to hire someone, see http://www.slipstick.com/dev/devlist.asp
for a list of possibilities.

If you want to try it yourself, these web pages should help you get started
with Outlook VBA:

http://www.winnetmag.com/Articles/Index.cfm?ArticleID=21522&pg=1
http://www.outlookcode.com/d/vb.htm


--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top