PDA

View Full Version : Word macro do not show XE field codes/formatting



VBP7z
10-18-2019, 08:13 PM
Does anyone have a Word macro that will prevent XE field codes and formatting from displaying after marking an index entry?

gmayor
10-18-2019, 08:28 PM
You can toggle the display of hidden text with


Sub ShowHidden()
With ActiveWindow.View
.ShowHiddenText = Not .ShowHiddenText
.ShowAll = False
End With
lbl_Exit:
Exit Sub
End Sub

VBP7z
10-18-2019, 08:45 PM
Graham,

Thanks, but I don't think this solves my problem. Word has a Mark Index Entry dialog. When you click Mark, Word automatically displays all formatting and XE field codes. This automatic, default action is what I am trying to prevent.

gmayor
10-19-2019, 04:52 AM
The display of hidden codes is intentional as an aid to seeing what you have marked and what you haven't. The macro posted attached to a ribbon or QAT button enables you to toggle between hidden and displayed. However you can inhibit the action, if you think you must, with a different macro, which will intercept the Word command.


Sub MarkIndexEntry()
On Error Resume Next
Application.Dialogs(wdDialogMarkIndexEntry).Show
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = False
End With
End Sub