Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 team@superuser.com to get them merged. –  ChrisF Apr 27 '10 at 15:27

2 Answers 2

Press Shift+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. –  Pinger Mar 26 '12 at 19:15

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
        MyData.PutInClipboard

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

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

Your Answer

 
discard

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.