Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show\hide paragraphs on a word

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
I think this is a rhetorical question (the answer being "it's not possible") but is it possible to have optional paragraphs in a word form?

For example,

You check a checkbox item on a form and a paragraph appears, you uncheck it and it disappears.

I have looked at checkbox controls and can only find a run macro on entry or exit. I could write a macro that creates the text but if the user toggles the control then this probably wouldn't work very well because their responses would have to be removed and added again.

My only other option is to use a VB form and put the details into a document.

Mark Davies
Warwickshire County Council
 
Hi Mark,

It *is* possible:

Part one actually IS easy: you can toggle the "Font.Hidden" property of each paragraph depending on check box values.

Part two is more difficult: you have to be able to identify the correct paragraph to hide/unhide. You could do so by applying start/end bookmarks to each paragraph whose visibility shall be toggled.
However you should also take into account the variations this will cause in page length / page breaks as you can no longer know the length of the resulting text.

But if that does not pose a problem...

;-)

Cheers,
Andy


[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Andy, thanks for your hidden text idea. It works but suffers the same drawback I was getting with the method I was using (inserting and removing the paragraph). After a morning of playing around with this I am sure it is possible to do this with form objects.

The main reason why I have come to this conclusion is form protection. To enable form objects in a word document you have to protect the form. If you want to perform any action such as going to a bookmark, you have to uprotect the form and when you protect it again all the form values are lost. You can save the values back to public variables and reset them when the form is protected again. However, I couldn't seem to reset the value of checkboxes.

Mark Davies
Warwickshire County Council
 
when you protect it again all the form values are lost. "

Not always.

When you protect again, make sure NoReSet:=True.

If true, then....there is no reset, therefore the existing values remain.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top