Mail merge

J

Jen

Hi, What does the following message mean?

Error! Unknown op code for conditional.

How can I copy/paste the field codes without paste the
field results(values)?
Thanks,Jen
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Jen,

It means that there is some error in the field code that you have
constructed.

To be able to copy and paste the field codes, you need to a macro to convert
them to ordinary text:

The following macro will place an ordinary text replica of the selected
field on the clipboard from where you can paste it to the desired location:

Sub FieldCodeToString()
Dim Fieldstring As String, NewString As String
Dim CurrSetting As Boolean, fcDisplay As Object
Dim MyData As DataObject
NewString = ""
Set fcDisplay = ActiveWindow.View
Application.ScreenUpdating = False
CurrSetting = fcDisplay.ShowFieldCodes
If CurrSetting <> True Then fcDisplay.ShowFieldCodes = True
Fieldstring = Selection.Text
For X = 1 To Len(Fieldstring)
CurrChar = Mid(Fieldstring, X, 1)
Select Case CurrChar
Case Chr(19)
CurrChar = "{"
Case Chr(21)
CurrChar = "}"
Case Else
End Select
NewString = NewString & CurrChar
Next X
Set MyData = New DataObject
MyData.SetText NewString
MyData.PutInClipboard
fcDisplay.ShowFieldCodes = CurrSetting
End Sub

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - 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