'Seeing' text in fields

E

Ed

I am trying to avoid search and other activity in fields (the kind that
are revealed/hidden when alt-F9 is pressed.) I want to be able to see the
fields, but not have Word (or my VBA commands) do anything. In particular, I
want to count the number of forward slashs in a particular paragraph. This
particular paragraph contains a field. The field contains slashs within its
content. Even when the field is toggled 'off' the field displays slashes
because the default answer which is calculated by the <<IF>> field contains
slashes. Therefore it is simply not possible to hide all slashes (or is
there?). Is there anyway to tell VBA to ignore all text within a field, or
to temporarily hide a field, while certain processes are being conducted?

--Ed in Virginia.
 
E

Ed

I have answered my own questions, but in case anyone is interested in the
solution, here it is.

I wrote a small routine to quickly run through and select every field. I
then look in the selected field to see if it contains a slash. If it does, I
hide it. That way the slashes cannot be processed.

Sub HideSlashFields()
For Each ofield In ActiveDocument.Fields
ofield.Select
If InStr(Selection, "/") Then Selection.Font.Hidden = True
Next
End Sub

At the end of the routine, I unhide the hidden fields. Works like a charm.

Ed (in Virginia)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top