ASK field and font changes

W

Winters

I'm using the ASK field in a Word merge document and the font is different in
each place that the ASK field fills in. I have highlighted the entire "form"
and set it to one font size/type so I don't know where it's getting the
different fonts. Can anyone help me?
 
G

Graham Mayor

You will be reproducing the result of the ASK field in a REF field. Toggle
the field display (ALT+F9) and add a \*Charformat switch to each REF field
(remove any \*Mergeformat field already present). Or if you have a lot of
such fields, use the following macro:

Sub ChangeRefSwitch()
Dim oRng As Range
Dim iFld As Integer
Dim strChoice As String
Selection.HomeKey
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
strChoice = MsgBox("Replace Mergeformat switch with Charformat switch?" _
& vbCr & "Click 'No' to remove formatting switch completely", _
vbYesNoCancel, "Replace Formatting Switch")
If strChoice = 2 Then GoTo UserCancelled
If strChoice = vbYes Then
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldRef Then
If InStr(1, .Code, "MERGEFORMAT") <> 0 Then
.Code.Text = Replace(.Code.Text, "MERGEFORMAT",
"CHARFORMAT")
End If
If InStr(1, .Code, "CHARFORMAT") = 0 Then
.Code.Text = .Code.Text & " \* CHARFORMAT "
End If
.Update
End If
End With
Next iFld
End If
If strChoice = vbNo Then
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldRef Then
If InStr(1, .Code, "MERGEFORMAT") <> 0 Then
.Code.Text = Replace(.Code.Text, "\* MERGEFORMAT", "")
End If
If InStr(1, .Code, "CHARFORMAT") <> 0 Then
.Code.Text = Replace(.Code.Text, " \* CHARFORMAT ", "")
End If
.Update
End If
End With
Next iFld
End If
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
Exit Sub
UserCancelled:
MsgBox "User Cancelled", vbInformation, "Replace Formatting Switch"
End Sub

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


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

My web site www.gmayor.com

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

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