Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to copy text from a Word document containing field codes, so that when asted into another application, the FIELD CODES REMAIN AS RAW TEXT. i.e. something like

This is about whales { XE "Cetations:Whales" }. This is about dolphins { XE "Cetations:Dolphins" }.

rather than have the field codes stripped out?

share|improve this question
Perhaps I havn't explained it very clearly. I don't want to cut and paste individual field codes one at a time, but rather the body text of entire document with the field codes kept intact... – Faye Dyce Apr 27 '10 at 15:26
you've managed to create two accounts. E-mail to get them merged. – ChrisF Apr 27 '10 at 15:27

Add macro to document, select text, run macro, You can now copy fields codes to clipboard.

Ps. in office 2010 ALT+F9 is used to display fields codes.

Sub StuffFieldCode()
    Dim sField As String
    Dim sTextCode As String
    Dim bSFC As Boolean
    Dim MyData As DataObject
    Dim sTemp As String
    Dim J As Integer

    Application.ScreenUpdating = False

    If Selection.Fields.Count = 1 Then
        bSFC = Selection.Fields.Item(1).ShowCodes
        Selection.Fields.Item(1).ShowCodes = True
        sField = Selection.Text
        sTextCode = ""
        For J = 1 To Len(sField)
            sTemp = Mid(sField, J, 1)
            Select Case sTemp
                Case Chr(19)
                    sTemp = "{"
                Case Chr(21)
                    sTemp = "}"
                Case vbCr
                    sTemp = ""
            End Select
            sTextCode = sTextCode & sTemp
        Next J

        Set MyData = New DataObject
        MyData.SetText sTextCode

        Selection.Fields.Item(1).ShowCodes = bSFC
    End If

    Application.ScreenUpdating = True
End Sub
share|improve this answer

Press Alt+F9 to show the field code, then highlight all the text inside the braces {}. You can they copy and paste this text.

Here's a link to a macro someone wrote to do all the work: Copy and Pasting Field Codes

share|improve this answer
In office 2010 its ALT+F9 cant check right now its the same in previous versions. – infografik Mar 26 '12 at 19:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.