PDA

View Full Version : Toggle Show/Hide text



stylus
04-10-2012, 12:28 PM
I have google searched and fiddled around with a few different snippets of code I found but cannot get this to work. Sorry I am a noob.

I have around 3000 word documents that are work instructions for different tasks. The customer contacted us to see if we can update all 3000 of the documents to add checkboxes beside each step and make the checkboxes hide/show at the click of a button. It will be a global hide/show of all checkboxes in the document. When I say checkboxes I mean when the paper is printed hardcopy the technician can use a pen and check the box indicating the step was done. It can be a square box, or a line or whatever.


Part A: The customer wants to add a checkbox or underscore line ("___") infront if each individual step so that the technician can check off each step as they are done.

Part B: be able to show/hide the checkboxes so that the work instructions can be copied and pasted elsewhere with out including the checkboxes when pasted.


I have found some tools that will do find and replace of text within a folder full of documents, I was going to try one of them. I figured I could find and replace the action words used at the beginning of each step in the work instruction. Find "Pull" Replace with "___ Pull" there are 5-6 action words that are used pretty consistantly so I can get a large part of the boxes or underscores inserted and fix the rest during proofreading etc...

I cannot get past the part of toggle show/hide text so I haven't started the find and replace to insert checkboxes yet because I don't know if the checkboxes should be underscores with font=hidden, or a textbox, an image, a bookmark etc...

The macro has to be included in the document so that it is portable, or it has to be a function of word so that within a few clicks the customer shows/hides the checkbox. When I have tried to use the hidden font built into word I cannot figure out how to toggle the text on and off with out displaying all the formatting marks.


Current Work instruction form:
-----------------------------------------
Reset Widget Maker A1.

Pull the handle
Push the button
Call the dispatcher
Verify the ready light
Push the button
Watch for smoke
-----------------------------------------


Desired work instruction form:
-----------------------------------------
Reset Widget Maker A1.

___ Pull the handle
___ Push the button
___ Call the dispatcher
___ Verify the ready light
___ Push the button
___ Watch for smoke
-----------------------------------------

Paul_Hossler
04-10-2012, 05:14 PM
In Options, Display, Always show these formatting marks on the screen

You can check/uncheck 'Show Hidden Text' and other formatting characters

If you uncheck all of them, the 'Show/Hide' button will hide them all or show them all, including hiddent text.

Paul

fumei
04-10-2012, 05:48 PM
That is the minor problem. The major problem is the cutting/pasting of the instructions WITHOUT the checkboxes.

As for putting them in..I don't suppose the instruction paragraphs are their own style? Probably not, but if they were it would be easy to add something at the beginning of each instruction.

macropod
04-11-2012, 02:04 AM
Hi Stylus,

For some code to loop through all documents in a selected folder, executing a Find/Replace process on each of them, see: http://www.techsupportforum.com/forums/f57/find-repeated-words-and-highlight-them-639713.html#post3694577

As for hiding/displaying text based on the current state, using hidden text is quite unreliable. That's because the actual hiding and printing of such text is determined by how the user has Word configured, not on whether the text is formatted as hidden in a given document. The 'proper' way to do this would be to use, say, dropdown formfields with Yes/No options and formula fields using IF tests to determine whether to display the related content. An alternative, if you're determined to use checkboxes, is to link checkbox formfields to an 'on-exit' macro that either: (a) sets a document property that the formula fields using IF tests to determine whether to display the related content; or (b) actually inserts/deletes that content. Here's a link to some code that does the latter (it inserts more formfields as well, but you probably don't need to worry about that aspect): http://www.techsupportforum.com/forums/f57/solved-word-macros-either-or-code-606391.html

stylus
04-11-2012, 01:01 PM
As Macropod said, I think I want to stay away from the using hidden (font) text because I think that it could cause confusion. Just in the little bit tinkering that i did I managed to get my hidden text settings messed up.

I am not stuck on using a "checkbox" it seems to me that making each document in to a form will further complicate the issue. The "checkbox" could be an image, symbol, or some underscores ___ to make a line that could be "checked" with a pen.

Is there a way I could show/hide an image of a checkbox?
Is there a way I could show/hide text that is a bookmark?

Thanks everyone for the input so far.

stylus
04-11-2012, 01:59 PM
I think this might work for my needs. www_moreaddin_com


I am trying to figure out if I can do some global find and replace to insert the "more" buttons. I created one button and copied and pasted it, didn't seem to work out too good.

Tinbendr
04-11-2012, 06:45 PM
Be sure to check out Greg Maxey's site (http://gregmaxey.mvps.org/word_tip_pages/master_your_formfields.html), too. He has more than one page on checkboxes.