![]() |
|
#2
|
||||
|
||||
|
You can't merge part of a field, but if you were to use https://www.gmayor.com/email_merge_addin.html to merge to separate documents, you could use the following macro with it to get the last four digits of any 16 digit number
Code:
Sub LastFour(oDoc As Document)
Dim oNum As Range
Set oNum = ActiveDocument.Range
With oNum.Find
Do While .Execute(findText:="[0-9]{16}", MatchWildcards:=True)
oNum.Text = Right(oNum, 4)
oNum.Collapse 0
Loop
End With
lbl_Exit:
Set oNum = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Unable to insert line break or carriage return in mail merge field
|
shahid.majeed | Mail Merge | 4 | 09-19-2019 01:08 AM |
| Entering a number of 19 digits | Jo Freeman | Excel | 11 | 11-08-2017 06:20 AM |
| Having number's digits together | mohsen.amiri | Word | 0 | 06-23-2017 01:20 AM |
How do I create a field that will return the current paragraph number minus one in an automatic list
|
gugootz | Word | 1 | 11-23-2015 04:58 PM |
| Use a numerical merge field to subtract that number of months | MichaelSpedding | Mail Merge | 8 | 11-11-2015 01:11 PM |