Quote:
Originally Posted by macropod
Instead of trying to re-insert the formfields as each record is generated, via the MailMergeAfterRecordMerge event, you'd do better to wait until the merge has completed then re-insert the formfields for all records in a single pass - all you need is a placeholder for that, as the article in the link indicates.
|
Thanks again, I'm going to spend some time looking into this today. I wasn't sure if there was a way to access a specific section for each record of the merge once it was completed (I haven't done much VBA in Word before), and figured that appending an existing range to the end of the document after each record merge would be an easy way to accomplish this task.
Quote:
Originally Posted by macropod
As for values being lost, what you're doing suggests the formfields are not required after the merge - only their results. In that case, you could leave the formfields in the mailmerge main document but use a macro to convert them to their results before executing the merge. Just don't re-save the mailmerge main document after running the macro.
|
The problem is that the values are cleared when the data source is selected, and my goal is to allow the user to save the document once it has been set up (before the merge is run) so that they have the option to just run or re-run the merge when they need to. This would make their template uneditable once they set up the data source. Also, I'd like to leave the ability to edit these fields in the document after the merge as well.
One other issue that has come up is how I am activating the macro. Once the document is protected for the form fields, the Macros are greyed out (and I didn't want to have the user run them through the menu anyway), so I tried a command button (which, unless I'm doing something wrong, only worked until the document was closed and reopened), and using a MacroButton hyperlink. This seems to work, but requires double-clicking the link to run. Plus, the first click shifts the page view which I find not user-friendly. Is there a better option to give the user a way to run the macro?
Also, I want to reset all of the properties for those fields that are removed. From what I see, that article only creates a new form Field, and sets it's name and text. I need to set it's maximum length, as well as type (number/date/etc.). I don't see anywhere in the language help files that allows me to set these; they are either read only (Format, Type) or non-existant (Maximum Length).
Edit: after some contemplation, I think the way to go might be to use the method in that article, but instead of creating a new form field, locate the form field in the original document, then copy it's range to the merged document.