I use Outlook 2003 on Windows 7 Pro 64 bit
I am trying to use the code listed below to record a dialled number in Journal.
I use the autodialler function of Outlook, where I select between Business, Mobile & Home numbers.
If the listing in my Contacts folder has a Business number as well as a Mobile Number listed
and I select and autodial the Mobile number, the intention of the code is to record that Mobile number in the resulting Journal entry.
However, the Journal entry always lists the Business Number even though I selected and dialled the Mobile number.
Is there a problem with the code?
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(olFolderJournal).Items
Set objNS = Nothing
End Sub
Private Sub m_colCalItems_ItemAdd(ByVal Item As Object)
Dim objContact As Outlook.ContactItem
Dim strBusinessTelephoneNumber As String
Dim strHomeTelephoneNumber As String
Dim strMobileTelephoneNumber As String
Dim myUserProperty As UserProperty
Set myUserProperty = Item.UserProperties.Add("MyPhone", olText)
If Item.Links.Count = 1 Then
Set objContact = Item.Links(1).Item
strBusinessTelephoneNumber = objContact.BusinessTelephoneNumber
strHomeTelephoneNumber = objContact.HomeTelephoneNumber
strMobileTelephoneNumber = objContact.MobileTelephoneNumber
If strBusinessTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strBusinessTelephoneNumber
Item.Save
ElseIf strHomeTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strHomeTelephoneNumber
Item.Save
ElseIf strMobileTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strMobileTelephoneNumber
Item.Save
End If
End If
Set objContact = Nothing
End Sub
I am trying to use the code listed below to record a dialled number in Journal.
I use the autodialler function of Outlook, where I select between Business, Mobile & Home numbers.
If the listing in my Contacts folder has a Business number as well as a Mobile Number listed
and I select and autodial the Mobile number, the intention of the code is to record that Mobile number in the resulting Journal entry.
However, the Journal entry always lists the Business Number even though I selected and dialled the Mobile number.
Is there a problem with the code?
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(olFolderJournal).Items
Set objNS = Nothing
End Sub
Private Sub m_colCalItems_ItemAdd(ByVal Item As Object)
Dim objContact As Outlook.ContactItem
Dim strBusinessTelephoneNumber As String
Dim strHomeTelephoneNumber As String
Dim strMobileTelephoneNumber As String
Dim myUserProperty As UserProperty
Set myUserProperty = Item.UserProperties.Add("MyPhone", olText)
If Item.Links.Count = 1 Then
Set objContact = Item.Links(1).Item
strBusinessTelephoneNumber = objContact.BusinessTelephoneNumber
strHomeTelephoneNumber = objContact.HomeTelephoneNumber
strMobileTelephoneNumber = objContact.MobileTelephoneNumber
If strBusinessTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strBusinessTelephoneNumber
Item.Save
ElseIf strHomeTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strHomeTelephoneNumber
Item.Save
ElseIf strMobileTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strMobileTelephoneNumber
Item.Save
End If
End If
Set objContact = Nothing
End Sub