[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Microsoft Word - protecting Merge fields, etc

I have a Word Mailmerge template with a number of Merge fields in it. I have two questions:

a) how can I protect the merge fields in the documents which are based on the template, so that users cannot edit them?

b) one of the fields (which displays the name of the signatory) is at the foot of the letter and should appear a line or two below the body text of the letter which will be inserted by the user. Is it possible, after protecting all the merge fields, to indicate the position where the text should be inserted (between the upper - name and address and "salutation" - fields and the signatory field (possibly by displaying a notice: " insert body text here") so that, when the user inserts the text, the signatory field will be "pushed down" to appear after the body text?
0
bogorman
Asked:
bogorman
  • 9
  • 7
1 Solution
 
GrahamSkanRetiredCommented:
After the merge, there are no merge fields in the result document. They will all have been converted to fixed text. However, the whole document could be protected.

It would also be possible to devise a macro that would protect the whole result document except for a particular block, especially it the block were tagged with some particular text.

However, it does sound like running the mail-merge backwards. The idea of the mail merge is that you compose a letter and send it to all of (or a subset of) the addressees in your datasource. If you wanted some variation to the letter text, certain parts could be inserted differentially, depending some on the mergefield results. The tested mergefield could simply be 'status' type of field, with the result itself not appearing in the result document.
0
 
bogormanAuthor Commented:
Hi Graham,
The way it works at present is that I have set up a template with merge fields in it. Most of these are at the top - "heading" fields, and the usual name and address and salutation fields. There are also two fields which will appear below the letter text (the name and job title of the signatory).
The problem is that the user is allowed to insert the body text and create a letter from the template. I do not want the user to be able to change the fields, simply to be allowed to create a letter from the template and insert the body text.
The merging is handled by a program in visual basic and the data generated by an online database and copied to a text file on the server. The local visual basic program copies the text file to the users machine and runs the mailmerge. Editing of the body text by the user is, of course, done before the merge is run. The user can build up a "library" of letters and the name of the letter can be selected from within the local visual basic program.
Ideally I would just like to have a template which has the merge fields protected and the area between the upper and lower ones marked with "please insert body text here". I suppose it would also be clearer to have the merge fields "labelled" with, say, "contact", "school name", "address1", etc.
Is this helpful to you?
Appreciate your help.
Brian

0
 
GrahamSkanRetiredCommented:
Perhaps that's even easier. Just set up the freeform body t area as a non-protected document section. The whole document can be unprotected by the VB program before the merge.

Do you actually need the User to have the top and tail parts of the letter visible? If not, the user could simply create a the letter body as a separate document, to be incorporated as a full letter Main document just before the merge is run.

Saving as a text file? Do you save without formatting as a policy, or is that just a generic use of the word 'text'
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
bogormanAuthor Commented:
Am not sure what you mean about saving without formatting. Had assumed that the only way to do this was to use a text file, e.g.:

Mr J G Gallears|The Priory School|Tintagel Road|Orpington|Kent|BR5 4LG||Dear Mr Gallears
Head of RE|Langley Park School for Girls|Hawksbrook Lane|South Eden Park Road|Beckenham|Kent|BR3 3BE|Dear Sir/Madam
...

which I merge with a Word mailmerge document. Would there be a better way of doing it, bearing in mind that the data is selected in an online database, copied to a file like the above and then copied from the server to the users machine?

Also,- an elementary question - how can I protect the merge fields in the document from editing? Have tried to find the answer without success. It would appear you can only protect a form in word. Believe with forms you can use continuous section breaks to provide a middle area which is not protected, but it doesn't seem to work on my template!
0
 
bogormanAuthor Commented:
Hi Dan,
Was hoping that Graham would respond as the question is not really answered. Is there any way of contacting him?
Regards
Brian
0
 
GrahamSkanRetiredCommented:
OK. Sorry about letting this one slip. A quick glsnce tells me that I couldn't add anything at the time, but I'll have another look, hopefully today.
0
 
bogormanAuthor Commented:
Thanks, Graham. Looking forward to hearing from you.
Will be away from Sunday for 10 days so cannot respond until my return unless you respond today or tomorrow.
Regards
Brian
0
 
GrahamSkanRetiredCommented:
OK Brian

There are two ways of protecting parts of a document in Word 2003 and one in 97 and 2000.

The one in common is Forms protection. This designed to have form fields where the user can enter data, while not being able to edit the surrounding text. However protection can be on a Section by Section basis, so you could put continuous (or otherwise) Section breaks in the document and thus create areas where the user can enter text while the parts of the document with the merge fields are still is still protected.

You can use the Forms Toolbar (padlock icon) to set and reset protection while designing, but to choose a password and select which sections are to be protected, you need to start from the Tools menu and use the Task pane.

To unprotect the document programatically, use

ActiveDocument.UnProtect Password
0
 
bogormanAuthor Commented:
Hi Graham,
Just off on holiday. Returning 28th. Will look at it then.
Many thanks
Brian
0
 
GrahamSkanRetiredCommented:
OK, Brian.
Hope you have a good one. Going anywhere nice?
0
 
bogormanAuthor Commented:
Hi Graham,
Apols for delay. Yes, we went to Tenerife - good weather, though gales at times, and a lovely break. Went on an excursion to the volcano and up in the cable car. They say you can see the African coast from there, but the weather, although brilliantly sunny, was not clear enough.
Have at last been able to look at your suggestions.
One point - If you protect the merge fields area in this way, will this prevent writing of data to them when the merge runs?
Regards
Brian
0
 
bogormanAuthor Commented:
Hi Graham,
One further point. Would you mind looking again at the question "Word Macro to convert footnotes..." which you started to answer but did not complete?
Regards
Brian
0
 
GrahamSkanRetiredCommented:
Sounds great. I'm not a great one for foreign holidays, though I spent a couple of years in Gibraltar (RAF), so I saw a lot of (Franco's) southern Spain and did get to Tangier.

Merging with protected documents is not possible. You would need some VBA to unprotect the document, run the merge and re-protect - but previewing would be out.

I'll look for the other question that I let slip.
0
 
bogormanAuthor Commented:
Hi Graham,
Many thanks. I thought that might be the case. I could do the merge using VBA but it works well at present, so I think we will just warn people not to tamper with the merge fields in the document.
By  the way, I assume you also can't protect the TEMPLATE from which the word documents are derived? Presumably protecting the template would also mean that the document merge fields would also be protected.
Regards
Brian
0
 
GrahamSkanRetiredCommented:
Yes. The document will inherit the protection. Again some VBA  (in the Template's ThisDocument module) could be used to remove it.
0
 
bogormanAuthor Commented:
Thanks, Graham.
Have assigned the points.
Looking forward to hearing your comments on the other question
Regards
Brian
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now