Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2014, 11:12 AM
ScottA ScottA is offline Copy / Print Merge code Windows 7 64bit Copy / Print Merge code Office 2010 32bit
Advanced Beginner
Copy / Print Merge code
 
Join Date: Apr 2014
Posts: 30
ScottA is on a distinguished road
Default Copy / Print Merge code

Two questions:


1)
Is there a way to copy and or print the merge code itself? I'd rather not type them all by hand (to much room for error with my fat fingers)

Every time I've tried I get the value of the current record, NOT what I "see on screen".

I understand that code can't be copied and pasted for use in a merge. I want to document them for my learning and also save the merge codes for those that might follow in my footsteps.

2) Is there a way to place comments in the code? Similar to using ' in VBA?

Thanks!

Scott
Reply With Quote
  #2  
Old 06-05-2014, 04:52 PM
macropod's Avatar
macropod macropod is offline Copy / Print Merge code Windows 7 32bit Copy / Print Merge code 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

Copying mergefields from a mailmerge main document copies the fields, not whatever might be displayed as a result of a preview. If they're pasted into another, ordinary, document and the fields are updated there all you should see is the field names enclosed by their chevrons (i.e. « »)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-05-2014, 06:27 PM
ScottA ScottA is offline Copy / Print Merge code Windows 7 64bit Copy / Print Merge code Office 2010 32bit
Advanced Beginner
Copy / Print Merge code
 
Join Date: Apr 2014
Posts: 30
ScottA is on a distinguished road
Default

Paul -

Just to make sure I was clear.

What I want to print out is:

{if {MERGEFIELD LVMass} < 200 {MERGEFIELD LVMass \# "0.00"} {MERGEFIELD LVMass \# "0.00"}}

What happens when I copy and print to a "normal" word doc is:

<<LVMass>>

If that is as expected I guess my answer is no. Correct?
Reply With Quote
  #4  
Old 06-05-2014, 06:46 PM
macropod's Avatar
macropod macropod is offline Copy / Print Merge code Windows 7 32bit Copy / Print Merge code 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

OK, you're copying more than just the mergefields - you're also copying IF fields that contain them. On their own, the mergefields will look like «LVMass». That's what you might also see when you copy one that's embedded in an IF field, but what you'll see in that case really depends on what the IF field is doing.

As for printing out the field codes, all that requires is checking Word's 'print field codes instead of their values' option.

I missed would question about comments before - that can be done in either of two ways:
{IF{ MERGEFIELD LVMass } < 200 { MERGEFIELD LVMass \# "0.00"} { MERGEFIELD LVMass \# "0.00"} {SET % Add comments here}}
or
{IF{ MERGEFIELD LVMass } < 200 { MERGEFIELD LVMass \# "0.00" } { MERGEFIELD LVMass \# "0.00"} /"Add Comments here"}
The first version merely uses a SET field to add some comments to a % bookmark, which you can re-use as often as you like. The second version, though simpler, relies on an undocumented technique that can't be guaranteed to work in future Word versions.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-06-2014, 07:32 PM
ScottA ScottA is offline Copy / Print Merge code Windows 7 64bit Copy / Print Merge code Office 2010 32bit
Advanced Beginner
Copy / Print Merge code
 
Join Date: Apr 2014
Posts: 30
ScottA is on a distinguished road
Default

Just what I was looking (and looking, and looking) for!

For anyone else reading this in the future the setting macropod suggested:
Quote:
As for printing out the field codes, all that requires is checking Word's 'print field codes instead of their values' option.
is located under File> Options> Advanced> Print

Thanks!!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
If two geographical data match in two sheets, copy unique id/code found in one sheet alliage Excel 1 09-01-2011 05:23 AM
vba Code to Print Spreadsheet to PDF OTPM Excel Programming 3 05-25-2011 08:22 AM
Modify vba code to print based on name in the InputBox OTPM Project 0 05-25-2011 02:03 AM
VBA Code to Print Individual Resource Lists to a pdf File OTPM Project 0 05-24-2011 12:21 PM
Help - Word adds secret code? Copy to notepad? andytaylor2006 Word 0 12-15-2006 11:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:48 PM.


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