Lost form fields after merge

  • Thread starter Darryl Kerkeslager
  • Start date
D

Darryl Kerkeslager

TextInput type FormFields are lost when doing a Mail Merge, but the
fix that MS has proposed is inadequate for my purposes.
http://support.microsoft.com/?kbid=286841


The Word fill-in forms that I have been given - and cannot substantially
alter - have blank Word *form* fields - textInput, checkbox, and combobox
form fields. Some of these, I want to merge data into, some of these I
don't, but instead want them to be left blank for the user to fill in
manually *after the merge*. Although checkboxes and comboboxes remain after
the merge, any unfilled textInput boxes are not present in the newly created
document. The user cannot then tab between the unfilled Word form fields
and fill them in.

Microsoft's workaround above is about the same as mine - I put the text
"<ff>" in the original doc, and then use vba to replace that with a form
field (from Access):

..Application.Selection.Find.ClearFormatting
Do While .Application.Selection.Find.Execute _
(FindText:="<ff>", Wrap:=wdFindContinue, Forward:=True) = True
.ActiveDocument.FormFields.Add _
Range:=.Application.Selection.Range, Type:=wdFieldFormTextInput
Loop

My main problem is that so far, I can only add a field - I cannot then
re-create the formatting that the original designers of the Word Document
intended
(underline, maximum width 2, uppercase, etc).



Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
 
P

Peter Jamieson

I can only suggest that you add a little bit more info to each <ff> tag to
store the formatting information you want and use it after the merge to
restore the formatting and so on.

e.g. if you want underline, set the field up as <ff_underline>, parse the
info. in your macro and apply the necessary properties. In this case, you
might be slightly better off inserting the fields you want by hand, then
using another bit of VBA to examine their properties and generate a "field
name" that encodes the information you want to transfer.

Peter Jamieson
 
D

Darryl Kerkeslager

Peter Jamieson said:
I can only suggest that you add a little bit more info to each <ff> tag to
store the formatting information you want and use it after the merge to
restore the formatting and so on.

e.g. if you want underline, set the field up as <ff_underline>, parse the
info. in your macro and apply the necessary properties.

Drat! I had hoped for a more elegant solution, but it seems that this
problem has no elegant solution, only work-araounds.

In this case, you might be slightly better off inserting the fields you
want by hand, then using another bit of VBA to examine their properties
and generate a "field name" that encodes the information you want to
transfer.

How do I put the information back in? For instance, I use this to add the
form field:

..ActiveDocument.FormFields.Add _
Range:=.Application.Selection.Range, Type:=wdFieldFormTextInput

How do I then say, "and make that form field two characters wide"?


--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
 
P

Peter Jamieson

How do I then say, "and make that form field two characters wide"?

Something like:

Dim oFormField as FormField
Set oFormField =
ActiveDocument.FormFields.Add(Range:=Application.Selection.Range, _
Type:=wdFieldFormTextInput)
With oFormField.TextInput
.Width = 2
End With

(You may find some of the relevant properties in the oFormField, and some in
oFormField.TextInput).
Drat! I had hoped for a more elegant solution, but it seems that this
problem has no elegant solution, only work-araounds.

Yes, there seem to have been many lost design opportunities in this area.

Peter Jamieson
 
D

Darryl Kerkeslager

Peter Jamieson said:
Something like:

Dim oFormField as FormField
Set oFormField =
ActiveDocument.FormFields.Add(Range:=Application.Selection.Range, _
Type:=wdFieldFormTextInput)
With oFormField.TextInput
.Width = 2
End With

(You may find some of the relevant properties in the oFormField, and some
in oFormField.TextInput).


Thank you for the help. I guess I have a lot of looking at the Word Object
Model ahead of me. At least now I know where to start.


--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top