How do I Format ASK and FILLIN fields?

M

Mattshanx

I am using the FILLIN (same problem for ASK fields) fields to populate a
number of fields in a protected document. It works great but the formatting
is inconsistent.

The field populates titles and body text sometimes correctly and sometimes
not.

Are there any commands or switches to ensure the formatting is the same as
the preceeding or following text?

I have tried \* MERGEFORMAT but this does not work consistently.

Any help would be appreciated.

Thanks,

Matt
 
G

Graham Mayor

A \*Charformat switch will format the field as entered.
Ask fields do not need such a switch as they only prompt for information to
a bookmark. The nookmark is reproduced with a REF field and this too can be
used with a charformat field.

On my own PC I use a macro to intercept the Insert > Field command and turn
off the default Mergeformat switch option. The macro also additionally
checks whether the Mergeformat option has been checked and if it has gives
the user the option to add the Charformat switch instead.

Sub InsertField()
Dim oRng As Range
Dim i As Variant
Dim sSwitch As String
Dim strChoice As String
SendKeys "{Tab}{Tab} +{Tab}+{Tab}"
Dialogs(wdDialogInsertField).Show
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Set oRng = Selection.Range
With oRng.Fields(1)
If InStr(1, .Code, "MERGEFORMAT") <> 0 Then
sSwitch = MsgBox("Use charformat in place of the mergeformat
switch?", _
vbYesNo, _
"Insert Field")
If sSwitch = vbYes Then
.Code.Text = Replace(.Code.Text, _
"MERGEFORMAT", _
"CHARFORMAT")
End If
End If
.Update
End With
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

Mattshanx

Thanks a million Graham,

Great advice.

Graham Mayor said:
A \*Charformat switch will format the field as entered.
Ask fields do not need such a switch as they only prompt for information to
a bookmark. The nookmark is reproduced with a REF field and this too can be
used with a charformat field.

On my own PC I use a macro to intercept the Insert > Field command and turn
off the default Mergeformat switch option. The macro also additionally
checks whether the Mergeformat option has been checked and if it has gives
the user the option to add the Charformat switch instead.

Sub InsertField()
Dim oRng As Range
Dim i As Variant
Dim sSwitch As String
Dim strChoice As String
SendKeys "{Tab}{Tab} +{Tab}+{Tab}"
Dialogs(wdDialogInsertField).Show
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Set oRng = Selection.Range
With oRng.Fields(1)
If InStr(1, .Code, "MERGEFORMAT") <> 0 Then
sSwitch = MsgBox("Use charformat in place of the mergeformat
switch?", _
vbYesNo, _
"Insert Field")
If sSwitch = vbYes Then
.Code.Text = Replace(.Code.Text, _
"MERGEFORMAT", _
"CHARFORMAT")
End If
End If
.Update
End With
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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