| Character code | Description | |
| 7 (beep) | Removed unless preceded by character 13 (paragraph), then converted to character 9 (tab). | |
| 10 (line feed) | Converted to character 13 (paragraph) unless preceded by character 13, then removed. | |
| 13 (paragraph) | Unchanged. | |
| 31 (optional hyphen) | Removed. | |
| 160 (nonbreaking space) | Converted to character 32 (space). | |
| 172 (optional hyphen) | Removed. | |
| 176 (nonbreaking space) | Converted to character 32 (space). | |
| 182 (paragraph mark) | Removed. | |
| 183 (bullet) | Converted to character 32 (space). | |
| Character code | Description | |
| 7 (beep) | Removed unless preceded by character 13 (paragraph), then converted to character 9 (tab). | |
| 10 (line feed) | Converted to character 13 (paragraph) unless preceded by character 13, then removed. | |
| 13 (paragraph) | Unchanged. | |
| 31 (optional hyphen) | Removed. | |
| 194 (optional hyphen) | Removed. | |
| 202 (nonbreaking space) | Converted to character 32 (space). | |
cleanUp = Application.CleanString(Selection.Text)
Set myDoc = Documents.Add
myDoc.Content.InsertAfter cleanUp
This example removes nonprinting characters from the selected field code and then displays the result.
ActiveWindow.View.ShowFieldCodes = True
ActiveDocument.Fields(1).Select
MsgBox Application.CleanString(Selection.Text)