Journal problem recording correct phone number

Status
Not open for further replies.

donwb

Member
Outlook version
Email Account
POP3
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
 
This:

If strBusinessTelephoneNumber <> "" Then
Item.UserProperties("MyPhone") = strBusinessTelephoneNumber

says if the number is not blank, to use it.

I'll have to double check, but i don't think you can get the number dialed - the dialer is not exposed in the object model - but that is what you would need to grab to get the correct number. Or maybe check to see if other numbers have entries and ask which one you want to choose.
 
Hi Diane

Thanks for your reply.

Could you please clarify this part of your answer:-

"Or maybe check to see if other numbers have entries and ask which one you want to choose."

also, when you say:-




"but I don't think you can get the number dialed"



I presume you mean that even if I dial Mobile, Outlook defaults to Business for entry in Journal. If that's so, what would be the criteria for choosing this default?



Kind Regards

donwb
 
You could do something like the following (for example only, the code is not complete :))

if mobile <>"" then
inputbox ("which number do you want to use?")
' more code

end if

When you use the dialer, Outlook can't detect which number you are dialing, only who you are calling. It can grab all of the numbers and anything field in the contact, but it doesn't know which number you actually selected in the call dialog.
 
Thanks Diane

As Outlook can't detect which number I'm dialing, then there's nothing more I can do.

I will put Business and Mobile numbers into separate Contact entries.

Regards

donwb
 
I'd probably use an if statement to check - it will require input from you though, where separate contacts won't.

dim caller as string then change your code like this - after the call, you need to press b, h, or m and it will use the correct number. You could make it a little more complicated by checking numbers and if there is only 1, use it instead of asking which one to use.

Code:
caller = InputBox("Which number?") 
 
If caller = "b" Then
Item.UserProperties("MyPhone") = strBusinessTelephoneNumber
Item.Save
ElseIf caller = "h" Then
Item.UserProperties("MyPhone") = strHomeTelephoneNumber
Item.Save
ElseIf caller = "m" Then
Item.UserProperties("MyPhone") = strMobileTelephoneNumber
Item.Save
 
This checks to see if either biz or mobile is empty and if so, use the field that has a number. if both have number, it asks which to use

Code:
 If strBusinessTelephoneNumber = "" Or strMobileTelephoneNumber = "" Then
If strBusinessTelephoneNumber <> "" Then
    Item.UserProperties("MyPhone") = strBusinessTelephoneNumber
      Item.Save
    ElseIf strMobileTelephoneNumber <> "" Then
   Item.UserProperties("MyPhone") = strMobileTelephoneNumber
   Item.Save
   Exit Sub
End If
Else
caller = InputBox("Which number?") 
 
If caller = "b" Then
Item.UserProperties("MyPhone") = strBusinessTelephoneNumber
Item.Save
ElseIf caller = "h" Then
Item.UserProperties("MyPhone") = strHomeTelephoneNumber
Item.Save
ElseIf caller = "m" Then
Item.UserProperties("MyPhone") = strMobileTelephoneNumber
Item.Save
End If
 End If
 
Many thanks for the code. I'll try it shortly & let you know the result.

donwb
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J What are .PST.db and .PST.db.journal Files? Using Outlook 2
J "Contact" button in Journal entry Using Outlook 1
I "diary or "journal" in Calendar Using Outlook 1
F I want to migrate Outlook journal to excel including contact names Using Outlook 10
E delete journal folder Using Outlook 2
gavin davis Journal and tasks Using Outlook 1
D How to show just the date in an Outlook 2010 Journal view Using Outlook 1
T Contact Field Data not showing in Journal Entry List Using Outlook 4
D Journal to show Phone Number dialled. Using Outlook 3
J Outlook replacement options - contact journal activities lost Using Outlook 23
G calls to journal Using Outlook 2
R Missing outloook journal entry pop up windows Using Outlook 13
M Sync Outlook 2010 Notes and Journal with iPhone 4 Using Outlook 1
B Are their other Outlook Journal entry forms besides the standard? Outlook VBA and Custom Forms 1
M Fixing broken Journal links to Contacts in Outlook 2007 Outlook VBA and Custom Forms 3
Victor_50 Problem - Google Workspace will stop "unsafe" access to Outlook end 2024 Using Outlook 3
Geldner Problem submitting SPAM using Outlook VBA Form Outlook VBA and Custom Forms 2
A Online Mode to Cached Exchange Mode problem Using Outlook 2
S Problem Accessing .MSG Property 'ImageNaturalHeight' Tag '0x80010003' Outlook VBA and Custom Forms 1
T Problem when requesting to view an email in a browser Using Outlook 0
R Outlook 2021 Having problem setting up outlook 2021 with windows 11. I have 3 gmail accounts and I want the 3 gmail, emails to merge into the same outlook input. Using Outlook.com accounts in Outlook 0
e_a_g_l_e_p_i Is anyone else having problem conneccting to gmail? Using Outlook 27
P Outlook calendar and contacts sync problem-outlook disconnects Using Outlook.com accounts in Outlook 2
S Archiving and Likely Modified Date Problem Using Outlook 3
R Problem moving file “Email folders.pst” to new PC Using Outlook 5
S Problem Checking the available stores in my Inbox (Outlook VBA) Outlook VBA and Custom Forms 0
Witzker GetAssignedView Problem Outlook VBA and Custom Forms 2
M Outlook 2010 Problem with OutLook 2010 32 bit, after Windows Auto Update Using Outlook 3
Marc2019 Outlook 2016 Font Problem Using Outlook 5
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
D Problem with custom form including _DocSiteControl1 Outlook VBA and Custom Forms 0
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
D Sort Problem with Sent Folders Using Outlook 1
S Conditional formatting problem with "is not empty" and categories Using Outlook 2
Mark Foley The upload of "Calendar" failed. There was a problem with the request. Using Outlook 6
avant-guvnor Import csv problem Using Outlook 7
katehawkins Outlook 2013 Ost to pst conversion problem Using Outlook 1
AbbieWhite The problem with a fairly large file. Using Outlook 3
I Outlook 2013 Send problem - 'Not Responding' forever Using Outlook.com accounts in Outlook 10
EmelineGueguen Help to understand the problem of work Using Outlook 1
W Outlook 2016 search problem persists after applying all known solutions Using Outlook 12
S problem with convert Using Outlook 1
S SendFromAccount - Problem trying to test existing value in open email Outlook VBA and Custom Forms 2
DruinaBiscardi unexpected problem in outlook Using Outlook 1
V Outlook 2003 problem with Windows 10 Creators Update 1709 Using Outlook 0
G Windows Update Causes BCM Database Access Problem? BCM (Business Contact Manager) 4
Grimev66 problem with conversion ost to pst Using Outlook 2
R Problem with searching public folders Exchange 2013/16 Exchange Server Administration 2
J Problem with Outlook 2016 new mail tray icon alert (envelope in the systems tray) Using Outlook.com accounts in Outlook 0

Similar threads

Back
Top