Skip to main content

How to quickly convert field codes to plain text in Word

If you have encountered a problem of converting field codes to plant text, this tutorials will help you.

Convert filed codes to text with VBA

Convert filed codes to text with Kutools for Word

Recommended Productivity Tools for Word

Kutools for Word: Integrating AI 🤖, over 100 advanced features save 50% of your document handling time.Free Download

Office Tab: Introduces the browser-like tabs to Word (and other Office tools), simplifying multi-document navigation.Free Download


arrow blue right bubble Convert filed codes to text with VBA

Office Tab: Brings tabbed interfaces to Word, Excel, PowerPoint...
ot word middle ad 100
Enhance your workflow now.      Read More       Free Download

1: Press Alt+F11 to open the Microsoft Visual Basic for Applications window;

2: Click Module from Insert tab, copy and paste the following VBA code into the Module window;

3: Click Run button doc-run-button or press F5 to apply the VBA.

The VBA code on converting field codes to text:

Note: The below VBA codes can cause two different results, you can choose to use by your own needs.

VBA 1: Create a new Word document to save the converted field codes:

Sub fieldcodetotext ()
Dim MyString As String, FieldShowSetting As Boolean
For Each aField In ActiveDocument.Fields
aField.Select
MyString = MyString & vbCr & Selection.Fields(1).Code.Text
Next aField
Documents.Add
ActiveDocument.Content.InsertAfter MyString
End Sub

VBA 2: Convert the field codes to text in the original document

Sub fieldcodetotext ()
Dim MyString As String
ActiveWindow.View.ShowFieldCodes = True
For Each aField In ActiveDocument.Fields
aField.Select
MyString = "{ " & Selection.Fields(1).Code.Text & " }"
Selection.Text = MyString
Next aField
ActiveWindow.View.ShowFieldCodes = False
End Sub

Note: With this VBA code, you cannot convert field codes to text from a selection of the document.


arrow blue right bubble Convert filed codes to text with Kutools for Word

Get rid of these annoying VBA codes, Kutools for Word's Convert Field Codes to Text utility can help you quickly convert field codes to text not only from the whole document but also from the selected part of the document.

Kutools for Word, a handy add-in, includes groups of tools to ease your work and enhance your ability of processing word document. Free Trial for 45 days! Get It Now!

1. Please apply this utility by clicking Kutools > More > Convert Field Codes to Text. See screenshot:

2. After clicking Convert Field Codes to text, there will be a prompt box showing up to remind you the conversion. Please click Yes to start the operation.

3. All field codes in the whole document are converted to plain text. See screenshot:

doc-convert-field-code-to-text-4

Note: If you just want to convert field codes to text from the selected part of the document, please select the field codes range and then applying this utility.

Please click here to get more information about Kutools for Word's Convert Field Codes to Text.


Relative articles:


Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

🤖 Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Inquire for Information based on Document, all within Word

📘 Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to our Remove Group...

Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert Group...

🔍 Precision Selections: Pinpoint specific pages  /  tables  /  shapes  /  heading paragraphs  /  Enhance navigation with more Select features...

Star Enhancements: Navigate swiftly to any location  /  auto-insert repetitive text  /  seamlessly toggle between document windows  /  11 Conversion Tools...

👉 Want to try these features? Kutools for Word offers a 60-day free trial, with no limitations! 🚀
Free Download     Read More     Buy Now
 
Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour merci pour ce partage.
Je voudrais savoir comment transcrire le code source d'une vidéo en texte ( des phrases )
merci
This comment was minimized by the moderator on the site
Bonjour, je voudrais savoir s'il y a moyen de convertir le code source d'une vidéo en texte lisible.
merci infiniment
This comment was minimized by the moderator on the site
You did a great job, I tried one-day to get text results but no result. Thanks for code.
This comment was minimized by the moderator on the site
If you want to convert all field codes to text, select your whole document with CTRL+A, then press CTRL+SHIFT+F9
This comment was minimized by the moderator on the site
This may work for field codes within the body of a document, but will not work on field codes within a table (e.g., a table of cross references to various locations within a document).
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations