ShowHiddenText

U

Ulf Nilsson

Hi,
I loop through my document and when the macro finds a textbox with the text
"$&" it hides it with:
ActiveDocument.Bookmarks(Mid(fFalt.Name, 6)).Range.Font.Hidden = True
I also hides the checkbox with:
ActiveDocument.Bookmarks(fField.name).Range.Font.Hidden = True

When I want to show all the textboxes and checkboxes, I use:
Selection.WholeStory
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
If Selection.Type = wdSelectionNormal Then
Selection.Font.Hidden = False
End If

BUT only the checkboxes will show, not the textboxes. I can see the code for
the textboxes using Alt + F9, so I have not deleted them.
I have also tried:
ActiveWindow.View.ShowHiddenText = True

What have I left to try? Any suggestion?

// Ulf
 
K

Klaus Linke

Hi Ulf,

For the text inside the text boxes, you'd probably have to loop through
them.

But probably an easier way to go about the whole problem would be to use one
or more dedicated paragraph style(s) for everything you want to toggle
between "hidden" and "not hidden", and simply change the definition
(myStyle.Font.Hidden = Not myStyle.Font.Hidden).

If that's not possible, and you still have problems, post back!

Regards,
Klaus
 
U

Ulf Nilsson

Hi Klaus,
I am looping through all the text boxes to find all the $&.

The problem with your solution is that when Show/Hide All is on, the hidden
text is shown.

// Ulf
 
K

Klaus Linke

Ulf Nilsson said:
I am looping through all the text boxes to find all the $&.

Sounds like you've got it working now, I take it...

[re using styles and toggle them between "hidden"/"not hidden"]
The problem with your solution is that when Show/Hide All is on,
the hidden text is shown.

That's always the case if you use hidden text, isn't it?

Klaus
 
U

Ulf Nilsson

My solution was to loop through every field, selection the field and:
Selection.Range.Font.Hidden = False

// Ulf

Klaus Linke said:
Ulf Nilsson said:
I am looping through all the text boxes to find all the $&.

Sounds like you've got it working now, I take it...

[re using styles and toggle them between "hidden"/"not hidden"]
The problem with your solution is that when Show/Hide All is on,
the hidden text is shown.

That's always the case if you use hidden text, isn't it?

Klaus
 
D

Doug Robbins - Word MVP on news.microsoft.com

You probably do not need to actually select each formfield

Dim ff As FormField
For Each ff In ActiveDocument.FormFields
ff.Range.Font.Hidden = False
Next ff

should be quicker.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ulf Nilsson said:
My solution was to loop through every field, selection the field and:
Selection.Range.Font.Hidden = False

// Ulf

Klaus Linke said:
Ulf Nilsson said:
I am looping through all the text boxes to find all the $&.

Sounds like you've got it working now, I take it...

[re using styles and toggle them between "hidden"/"not hidden"]
The problem with your solution is that when Show/Hide All is on,
the hidden text is shown.

That's always the case if you use hidden text, isn't it?

Klaus
 

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