|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
how to format a picture switch in a merge field to only include the numbers in the middle?
I am trying to use a merge field in which the merged field only includes numbers and I want to use a picture switch or some other mechanism so that only numbers in the middle of the field appear. I can figure out how to make only the last group of numbers appear in the merged document, but not numbers in the middle. For example, the merged field will always consist of 6-digit number (e.g., 123456) and I want only the 2nd and 3rd numbers (from the right) to print (in this example, the 4 & 5 to print as 45). Is it possible to manipulate the merge field code to do this? I appreciate any help! |
#2
|
||||
|
||||
You could use a formula for your mergefield, coded along the lines of:
{=MOD(INT({MERGEFIELD MyField}/10),100) \# 00} or: {=MOD(INT(«MyField»/10),100) \# 00} where 'MyField' is your field name. Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the 'Insert Merge Field' dropdown.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Success!!!
Paul, you are one smart guy! I struggled with this for so long before initiating this string and couldn't figure it out. Your second code worked perfectly! Thank you so much for your help! I hope some day this will all make sense to me... until then, thanks for a solution!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Define custom Cross-reference output format to include "static" text and pg numbers | cyclops755 | Word VBA | 9 | 01-17-2023 02:42 PM |
Custom format a merge field | paul h | Mail Merge | 2 | 09-09-2015 07:18 AM |
Macro to select an { includepicture } field code and format the picture behind text and 100% scale | sanpedro | Word VBA | 3 | 03-30-2015 10:50 PM |
Mail merge will not format date field generated by Excel IF statement | borntorun75 | Mail Merge | 3 | 12-16-2011 06:28 AM |
Adding a DASH in the middle of my field | steven.allman | Mail Merge | 5 | 04-11-2011 02:24 PM |