Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2016, 01:20 PM
amikelsons amikelsons is offline How to self-reference a bookmark? Windows 7 64bit How to self-reference a bookmark? Office 2010 64bit
Novice
How to self-reference a bookmark?
 
Join Date: May 2016
Posts: 2
amikelsons is on a distinguished road
Default How to self-reference a bookmark?

I'm setting up an xml mail merge template. I need to have a bookmark self-reference itself (am trying to use it as a variable that adds onto itself with every record), but i keep getting the error "Not a valid bookmark self-reference".
Here is what I'm trying to do:


{IF {MERGEREC} = "1"}{SET ItemList ""}
{SET ItemList "{REF ItemList}{MERGEFIELD Quote_Product_Existing_Product}"}

I found someone's solution to the same problem only they were trying to do numeric calculations. The suggestion was to use:
{ SET C "{= {mergefield qty} + {REF C}" }
and the poster said that it worked perfectly. Though mine is different without the = part (also it seems to me that they are missing a }), and it's not working. What am I missing? Please help! thanks.
Reply With Quote
  #2  
Old 05-15-2016, 03:28 PM
macropod's Avatar
macropod macropod is offline How to self-reference a bookmark? Windows 7 64bit How to self-reference a bookmark? 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

What are you trying to achieve? A field coded like:
{SET ItemList "{REF ItemList}{MERGEFIELD Quote_Product_Existing_Product}"}
would simply append whatever is in your 'Quote_Product_Existing_Product' field to your bookmark for every record.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-15-2016, 03:37 PM
macropod's Avatar
macropod macropod is offline How to self-reference a bookmark? Windows 7 64bit How to self-reference a bookmark? 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

Cross-posted at: http://answers.microsoft.com/en-us/o...d-05e557e9fb45
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 05-15-2016, 05:04 PM
amikelsons amikelsons is offline How to self-reference a bookmark? Windows 7 64bit How to self-reference a bookmark? Office 2010 64bit
Novice
How to self-reference a bookmark?
 
Join Date: May 2016
Posts: 2
amikelsons is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
What are you trying to achieve? A field coded like:
{SET ItemList "{REF ItemList}{MERGEFIELD Quote_Product_Existing_Product}"}
would simply append whatever is in your 'Quote_Product_Existing_Product' field to your bookmark for every record.
Yes, that's exactly what I want. The problem is it's giving me an error instead of appending it on. So there is something wrong with my syntax, but no matter what variation i try, i can't get it right.

What I am trying to do is create a quote (one single quote for one customer) that includes a few different products. The quote displays a bunch of merge fields regarding the customer, and then below it there's a list of items and prices. The problem is that in the top part (that does not repeat, and that's all formatted), within a table of other info, they want to have included specific information that comes from 1 specific product. Which is right in the middle of {If {MERGESEQ} = "1"} then write the customer stuff. but at this point i can't display the info i need off of the 1 product. So what i thought i would do instead would be to traverse through all my records, adding the product info from each record into a variable/bookmark, and also if the record is that one special record, grab the field that i need from that one (into another bookmark). Then display my one-time items (about the customer, and that one special field from the one product), and then display my list of items and prices.

I'm open to other suggestions if there is a better way to accomplish that. But also want to know how to fix my syntax to append on to (to fix the self-reference error).
Reply With Quote
  #5  
Old 05-15-2016, 05:13 PM
macropod's Avatar
macropod macropod is offline How to self-reference a bookmark? Windows 7 64bit How to self-reference a bookmark? 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

Quote:
Originally Posted by amikelsons View Post
What I am trying to do is create a quote (one single quote for one customer) that includes a few different products. The quote displays a bunch of merge fields regarding the customer, and then below it there's a list of items and prices.
If I understand you correctly, these quote items vary with each quote. In that case, you can't use an ordinary merge. You can, however, use Word's Catalogue/Directory Mailmerge facility for this (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
http://windowssecrets.com/forums/sho...merge-Tutorial
or:
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip

The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.


The field coding for this is complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at:
https://www.msofficeforums.com/mail-...html#post23345
https://www.msofficeforums.com/mail-...html#post30327
http://windowssecrets.com/forums/sho...l=1#post928391

Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An example of this approach can be found at: http://answers.microsoft.com/en-us/o...1-1996c14dca5d
The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at: https://www.msofficeforums.com/mail-...html#post67097

Alternatively, you may want to try one of the Many-to-One Mail Merge add-ins, from:
Graham Mayor at http://www.gmayor.com/ManyToOne.htm; or
Doug Robbins at http://bit.ly/1hduSCB

In addition to a 'Many to One' merge, the latter handles:
• Merge with Charts
• Duplex Merge
• Merge with FormFields
• Merge with Attachments
• Merge to Individual Documents
• Merge, Print and Staple

Quote:
Originally Posted by amikelsons View Post
The problem is that in the top part (that does not repeat, and that's all formatted), within a table of other info, they want to have included specific information that comes from 1 specific product.
For that, all you need is a standard IF test, along the lines of:
{IF{MERGEFIELD Quote_Product_Existing_Product} = "Widget" "Additional text for Widget"}
in the appropriate part of the mailmerge main document. If you want to add that conditional text only after the repeating data, things are a bit more complicated, but still doable.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
bookmark, mail merge, self-reference

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Bookmark, move to bookmark, execute code, repeat raymm3852 Word VBA 10 04-15-2016 06:21 PM
How to self-reference a bookmark? Bookmark Not Showing Bookmark RegAudit Word 6 03-16-2015 11:08 PM
How to self-reference a bookmark? Reference number and cross reference for equation numbers to match the thesis format wmac Word 1 05-14-2013 08:54 PM
How to self-reference a bookmark? Need help with using bookmark and cross-reference mpdsal Word 1 07-26-2012 01:05 PM
How to self-reference a bookmark? updating multiple bookmark reference all at once gib65 Word 3 09-17-2011 10:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:37 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