Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2016, 07:18 AM
becca becca is offline how to format a picture switch in a merge field to only include the numbers in the middle? Windows 10 how to format a picture switch in a merge field to only include the numbers in the middle? Office 2013
Novice
how to format a picture switch in a merge field to only include the numbers in the middle?
 
Join Date: Jun 2016
Posts: 2
becca is on a distinguished road
Default 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!
Reply With Quote
  #2  
Old 06-07-2016, 06:20 PM
macropod's Avatar
macropod macropod is offline how to format a picture switch in a merge field to only include the numbers in the middle? Windows 7 64bit how to format a picture switch in a merge field to only include the numbers in the middle? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 06-08-2016, 01:15 PM
becca becca is offline how to format a picture switch in a merge field to only include the numbers in the middle? Windows 10 how to format a picture switch in a merge field to only include the numbers in the middle? Office 2013
Novice
how to format a picture switch in a merge field to only include the numbers in the middle?
 
Join Date: Jun 2016
Posts: 2
becca is on a distinguished road
Thumbs up 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!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to format a picture switch in a merge field to only include the numbers in the middle? Define custom Cross-reference output format to include "static" text and pg numbers cyclops755 Word VBA 9 01-17-2023 02:42 PM
how to format a picture switch in a merge field to only include the numbers in the middle? 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
how to format a picture switch in a merge field to only include the numbers in the middle? Mail merge will not format date field generated by Excel IF statement borntorun75 Mail Merge 3 12-16-2011 06:28 AM
how to format a picture switch in a merge field to only include the numbers in the middle? Adding a DASH in the middle of my field steven.allman Mail Merge 5 04-11-2011 02:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft