#1
|
|||
|
|||
Phone Number Replace ( ) and - with periods (I'm ALMOST there)
I have a mail merge document where the source phone number is (123) 456-7890. I want the phone number on the completed document to appear as 123.456.7890 .
I have used some info I found elsewhere from Macropod with a potential fix, but it doesn't seem to work in the application I'm using for the merge, so I'm thinking I'm missing something. I've attached some files to help understand what i'm getting here. On the document I'm designing, when I add the field, there is not a visible reference to the fieldname (mailmerge_entered.jpg). I'm thinking this may be the cause of the error in the application I'm using. When I expand the mailmerge field (Shift+F9), I can see the QUOTE tag and nothing much else). (mailmerge_expanded.jpg), so it's there. When I Update the field, the number formatting seems to be formatted correctly. (mailmerge_update.jpg) I would appreciate someone looking at the attached file (the macro is one from here that converts text to the mailmerge format) and let me know if I'm missing anything. Thanks in advance for any assistance you can offer. |
#2
|
||||
|
||||
Did you actually attach the data source to the document and complete the merge? It's a bit tortuous but Paul's field codes usually work as intended. This lot is no exception.
Press ALT+F9 to toggle the fields and it shows: {QUOTE{SET Phone {MERGEFIELD LeadBrokerHtcPhone}} {IF{REF Phone}= “?1*” 1 {IF{REF Phone}= “?2*” 2 {IF{REF Phone}= “?3*” 3 {IF{REF Phone}= “?4*” 4 {IF{REF Phone}= “?5*” 5 {IF{REF Phone}= “?6*” 6 {IF{REF Phone}= “?7*” 7 {IF{REF Phone}= “?8*” 8 {IF{REF Phone}= “?9*” 9 0}}}}}}}}} {IF{REF Phone}= “??1*” 1 {IF{REF Phone}= “??2*” 2 {IF{REF Phone}= “??3*” 3 {IF{REF Phone}= “??4*” 4 {IF{REF Phone}= “??5*” 5 {IF{REF Phone}= “??6*” 6 {IF{REF Phone}= “??7*” 7 {IF{REF Phone}= “??8*” 8 {IF{REF Phone}= “??9*” 9 0}}}}}}}}} {IF{REF Phone}= “???1*” 1 {IF{REF Phone}= “???2*” 2 {IF{REF Phone}= “???3*” 3 {IF{REF Phone}= “???4*” 4 {IF{REF Phone}= “???5*” 5 {IF{REF Phone}= “???6*” 6 {IF{REF Phone}= “???7*” 7 {IF{REF Phone}= “???8*” 8 {IF{REF Phone}= “???9*” 9 0}}}}}}}}} {IF{REF Phone}= “?????1*” “.1” {IF{REF Phone}= “?????2*” “.2” {IF{REF Phone}= “?????3*” “.3” {IF{REF Phone}= “?????4*” “.4” {IF{REF Phone}= “?????5*” “.5” {IF{REF Phone}= “?????6*” “.6” {IF{REF Phone}= “?????7*” “.7” {IF{REF Phone}= “?????8*” “.8” {IF{REF Phone}= “?????9*” “.9” “.0”}}}}}}}}} {IF{REF Phone}= “??????1*” 1 {IF{REF Phone}= “??????2*” 2 {IF{REF Phone}= “??????3*” 3 {IF{REF Phone}= “??????4*” 4 {IF{REF Phone}= “??????5*” 5 {IF{REF Phone}= “??????6*” 6 {IF{REF Phone}= “??????7*” 7 {IF{REF Phone}= “??????8*” 8 {IF{REF Phone}= “??????9*” 9 0}}}}}}}}} {IF{REF Phone}= “???????1*” “1.” {IF{REF Phone}= “???????2*” “2.” {IF{REF Phone}= “???????3*” “3.” {IF{REF Phone}= “???????4*” “4.” {IF{REF Phone}= “???????5*” “5.” {IF{REF Phone}= “???????6*” “6.” {IF{REF Phone}= “???????7*” “7.” {IF{REF Phone}= “???????8*” “8.” {IF{REF Phone}= “???????9*” “9.” “0.”}}}}}}}}} {IF{REF Phone}= “*1???” 1 {IF{REF Phone}= “*2???” 2 {IF{REF Phone}= “*3???” 3 {IF{REF Phone}= “*4???” 4 {IF{REF Phone}= “*5???” 5 {IF{REF Phone}= “*6???” 6 {IF{REF Phone}= “*7???” 7 {IF{REF Phone}= “*8???” 8 {IF{REF Phone}= “*9???” 9 0}}}}}}}}} {IF{REF Phone}= “*1??” 1 {IF{REF Phone}= “*2??” 2 {IF{REF Phone}= “*3??” 3 {IF{REF Phone}= “*4??” 4 {IF{REF Phone}= “*5??” 5 {IF{REF Phone}= “*6??” 6 {IF{REF Phone}= “*7??” 7 {IF{REF Phone}= “*8??” 8 {IF{REF Phone}= “*9??” 9 0}}}}}}}}} {IF{REF Phone}= “*1?” 1 {IF{REF Phone}= “*2?” 2 {IF{REF Phone}= “*3?” 3 {IF{REF Phone}= “*4?” 4 {IF{REF Phone}= “*5?” 5 {IF{REF Phone}= “*6?” 6 {IF{REF Phone}= “*7?” 7 {IF{REF Phone}= “*8?” 8 {IF{REF Phone}= “*9?” 9 0}}}}}}}}} {IF{REF Phone}= “*1” 1 {IF{REF Phone}= “*2” 2 {IF{REF Phone}= “*3” 3 {IF{REF Phone}= “*4” 4 {IF{REF Phone}= “*5” 5 {IF{REF Phone}= “*6” 6 {IF{REF Phone}= “*7” 7 {IF{REF Phone}= “*8” 8 {IF{ }= “*9” 9 0}}}}}}}}} } Don't even try to make that into fields without using Import and export field constructions as text. Copy it from the document. Or you could simply add another column to your data sheet with the number as text in the correct format and merge that field instead.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
Ultimately, if this code that I'm using SHOULD work, then it's the application that is the issue. I'm thinking it's the {QUOTE} before the rest of the code that's causing the issue, but I wanted to make sure I hadn't made an error somewhere else. Thanks again for your help. |
#4
|
||||
|
||||
Without seeing the actual merge document and some sample data it is not possible to guess the cause of the error, but the example you posted does work.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
Quote:
If the example I posted works, then it's likely how the application I'm using to create the mail merge document is the issue. I suspect it doesn't like the anything but the MAILMERGE tag, since the word document is saved to the application and it's basically an automatic internal process that creates the doc as needed. I'll see if there are other solutions, since it's apparently not really to do with the word doc itself. I appreciate your taking the time to review and answer. Cheers! T |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add custom phone number field to Outlook 2013 Contact? | King Mustard | Outlook | 0 | 06-10-2015 08:12 AM |
Extracting a phone number from a string that contains text and numbers. | hommi16 | Excel | 2 | 06-05-2013 09:19 PM |
Extract phone number from word file | donlincolnmsof | Word VBA | 12 | 06-19-2012 05:21 PM |
Phone number formatting | Mark Micallef | Outlook | 1 | 08-04-2010 02:38 PM |
in WORD, how do i type a 9-digit phone number "xxxxxxxxx" and have it automatically.. | jay8962 | Word | 0 | 04-08-2010 11:08 AM |