![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
OL 2002 SP3
Win XP HE Follow-up to: microsoft.public.outlook.contacts Hi, I have a folder with hundreds of contacts. All telephone numbers display as +12129999999 I would like to have them all display as +1 (212) 999-9999 It does automatically change to that if I manually open the contact and click on the little pencil icon to the right of the phone number field. However, I can't really do this manually for hundred's of contacts. How can I automate this? Thanks a lot. |
Ads |
#2
|
|||
|
|||
![]()
Try the Format function. In your case, it might look like this:
strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "stef" wrote: OL 2002 SP3 Win XP HE Follow-up to: microsoft.public.outlook.contacts Hi, I have a folder with hundreds of contacts. All telephone numbers display as +12129999999 I would like to have them all display as +1 (212) 999-9999 It does automatically change to that if I manually open the contact and click on the little pencil icon to the right of the phone number field. However, I can't really do this manually for hundred's of contacts. How can I automate this? Thanks a lot. |
#3
|
|||
|
|||
![]()
Eric Legault [MVP - Outlook] wrote:
Try the Format function. In your case, it might look like this: strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX Eric, that's sounds good. thanks. however, i only need to run this in ONE Contacts subfolder called ABC (for example). how do I run the code on that folder only? |
#4
|
|||
|
|||
![]()
You can use the ActiveExplorer object to work with the selection in the
currently displayed folder and base your code on that: If ActiveExplorer.Selection.count = 0 Then Exit Sub For Each objC In ActiveExplorer.Selection objC.BusinessTelephoneNumber = your code here Next -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "stef" wrote: Eric Legault [MVP - Outlook] wrote: Try the Format function. In your case, it might look like this: strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX Eric, that's sounds good. thanks. however, i only need to run this in ONE Contacts subfolder called ABC (for example). how do I run the code on that folder only? |
#5
|
|||
|
|||
![]()
Eric Legault [MVP - Outlook] wrote:
You can use the ActiveExplorer object to work with the selection in the currently displayed folder and base your code on that: If ActiveExplorer.Selection.count = 0 Then Exit Sub For Each objC In ActiveExplorer.Selection objC.BusinessTelephoneNumber = your code here Next Sorry Eric, I'm not experienced with VB. is this how the whole macro would read? "Sub ChangeTelFormat strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") If ActiveExplorer.Selection.count = 0 Then Exit Sub For Each objC In ActiveExplorer.Selection objC.BusinessTelephoneNumber = strX Next End Sub" |
#6
|
|||
|
|||
![]()
Yes, but you'd also of course need to declare the variables:
Dim objC As Outlook.ContactItem Dim strX As String -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "stef" wrote: Eric Legault [MVP - Outlook] wrote: You can use the ActiveExplorer object to work with the selection in the currently displayed folder and base your code on that: If ActiveExplorer.Selection.count = 0 Then Exit Sub For Each objC In ActiveExplorer.Selection objC.BusinessTelephoneNumber = your code here Next Sorry Eric, I'm not experienced with VB. is this how the whole macro would read? "Sub ChangeTelFormat strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") If ActiveExplorer.Selection.count = 0 Then Exit Sub For Each objC In ActiveExplorer.Selection objC.BusinessTelephoneNumber = strX Next End Sub" |
#7
|
|||
|
|||
![]()
Eric Legault [MVP - Outlook] wrote:
Yes, but you'd also of course need to declare the variables: Dim objC As Outlook.ContactItem Dim strX As String Eric, i must be doing something wrong as i'm getting an error message.... is there anyway i can get u to just spell it out for me out here, from beginning to end? that wd be most helpful. |
#8
|
|||
|
|||
![]()
Try this, but make sure to set a breakpoint on the Save line and do not
proceed with saving until you've verified that this Format function is changing the phone number as you'd expect. If ANY phone numbers don't meet the expected +########### format, they get all messed up. Sub ChangeTelFormat() Dim objC As Outlook.ContactItem Dim strX As String If ActiveExplorer.Selection.Count = 0 Then Exit Sub If ActiveExplorer.CurrentFolder.DefaultItemType olContactItem Then Exit Sub For Each objC In ActiveExplorer.Selection strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX objC.Save Next Set objC = Nothing End Sub -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "stef" wrote: Eric Legault [MVP - Outlook] wrote: Yes, but you'd also of course need to declare the variables: Dim objC As Outlook.ContactItem Dim strX As String Eric, i must be doing something wrong as i'm getting an error message.... is there anyway i can get u to just spell it out for me out here, from beginning to end? that wd be most helpful. |
#9
|
|||
|
|||
![]()
Eric Legault [MVP - Outlook] wrote:
Try this, but make sure to set a breakpoint on the Save line and do not proceed with saving until you've verified that this Format function is changing the phone number as you'd expect. If ANY phone numbers don't meet the expected +########### format, they get all messed up. Sub ChangeTelFormat() Dim objC As Outlook.ContactItem Dim strX As String If ActiveExplorer.Selection.Count = 0 Then Exit Sub If ActiveExplorer.CurrentFolder.DefaultItemType olContactItem Then Exit Sub For Each objC In ActiveExplorer.Selection strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX objC.Save Next Set objC = Nothing End Sub I changed the strx format as "+@ (@@@) @@@-@@@@" as the +1 is already part of the number I have: +18008888888 I added an "End If" at the end, and checked it w/debugger and ran it but no changes at all in folder "test". nothing bad, nothing good. just nothing.... i checked the telephone format and it's all good there but.... by the way, these contact numbers are in the Test folder from copying them from another folder into which i imported the numbers from a phone with XTDN. dt know if it makes a difference as far as OL reading them properly or not. Here is what i ran: Sub ChangeTelFormat() Dim objC As Outlook.ContactItem Dim strX As String If ActiveExplorer.Selection.Count = 0 Then Exit Sub If ActiveExplorer.CurrentFolder.DefaultItemType olContactItem Then Exit Sub For Each objC In ActiveExplorer.Selection strX = Format(objC.BusinessTelephoneNumber, "+@ (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX objC.Save Next Set objC = Nothing End If End Sub |
#10
|
|||
|
|||
![]()
The best I can recommend at this point is to step through your code line by
line and verify the values of the variables and the properties of your Contacts. You'll have to do some hard sleuthing and deducing to pinpoint the problem. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "stef" wrote: Eric Legault [MVP - Outlook] wrote: Try this, but make sure to set a breakpoint on the Save line and do not proceed with saving until you've verified that this Format function is changing the phone number as you'd expect. If ANY phone numbers don't meet the expected +########### format, they get all messed up. Sub ChangeTelFormat() Dim objC As Outlook.ContactItem Dim strX As String If ActiveExplorer.Selection.Count = 0 Then Exit Sub If ActiveExplorer.CurrentFolder.DefaultItemType olContactItem Then Exit Sub For Each objC In ActiveExplorer.Selection strX = Format(objC.BusinessTelephoneNumber, "+1 (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX objC.Save Next Set objC = Nothing End Sub I changed the strx format as "+@ (@@@) @@@-@@@@" as the +1 is already part of the number I have: +18008888888 I added an "End If" at the end, and checked it w/debugger and ran it but no changes at all in folder "test". nothing bad, nothing good. just nothing.... i checked the telephone format and it's all good there but.... by the way, these contact numbers are in the Test folder from copying them from another folder into which i imported the numbers from a phone with XTDN. dt know if it makes a difference as far as OL reading them properly or not. Here is what i ran: Sub ChangeTelFormat() Dim objC As Outlook.ContactItem Dim strX As String If ActiveExplorer.Selection.Count = 0 Then Exit Sub If ActiveExplorer.CurrentFolder.DefaultItemType olContactItem Then Exit Sub For Each objC In ActiveExplorer.Selection strX = Format(objC.BusinessTelephoneNumber, "+@ (@@@) @@@-@@@@") objC.BusinessTelephoneNumber = strX objC.Save Next Set objC = Nothing End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
error exporting phone numbers to a mobile phone | Andrew J Farrow | Outlook - Using Contacts | 0 | August 8th 06 11:43 AM |
change format of phone field from text to phone | Jim | Outlook - Using Contacts | 1 | May 19th 06 02:29 AM |
displaying mobile numbers with no area codes | John | Outlook - Using Contacts | 0 | April 26th 06 05:24 AM |
Displaying All Contact Names In The Same Format | Nathan Sokalski | Outlook - General Queries | 1 | April 1st 06 09:17 AM |
How can I standardize th format of all phone numbers in Contacts? | SJKopischke | Outlook - Using Contacts | 15 | February 25th 06 03:59 PM |