• Printing or Hiding Sectors (Word 2K)

    Author
    Topic
    #396929

    I have a series of headings and descriptions on a protected form. I would like to print the descriptions ONLY if the heading checkbox is selected, and hide/not print the description if the heading is not selected.

    X Main Heading
    Description paragraph here, which should print ONLY if the “Main Heading” box is selected.

    X Another Main Heading
    Next Description paragraph here, which should again print ONLY if the “Another Main Heading” box is selected.

    I assume the easiest way to refer to the description paragraph is by blocking it out into a separate continuous section (Call this one Section 1). I have developed a macro that can select the section and hide the paragraph (that’s easy!), but I can’t find the way to run the macro on a Before Print event.

    How does that work?

    Errol

    Viewing 1 reply thread
    Author
    Replies
    • #747690

      Before Print is not an event of the Document object. The Application object has a DocumentBeforePrint event, but that may be overkill, since it will fire for all documents. Why not include ActiveDocument.PrintOut in the macro you already have?

      • #747696

        Hans,

        Thanks for the tip. I may go that way. However, I’d like to make the description paragraphs available on the screen, and avoid printing them, if they’re not selected. (Otherwise we’ll be printing seven pages of useless information instead of, say, two pages.)

        Finally, rather than make the user run a macro (even in an attached button), they’d just print the thing with the usual print button (for transparency).

        How is it overkill?

        Errol

        • #747702

          As I wrote, there is no document-level Before Print event, it is an application-level event, so it will occur whenever the user prints a document, not just this specific one. If you would like to use this event, the document about to be printed is passed as an argument in the DocumentBeforePrint event procedure, so you can test which one it is.

          I don’t think there is an objection to use a custom print button or menu item for printing this document. After all, it isn’t the usual printout the user will get.

          Alternatively, you could run a macro when a check box is clicked, to hide or unhide the selection it is in. If you display hidden text on screen, and do not print hidden text, you’d get the desired effect without having to do anything special when printing.

          • #747708

            Hans,

            We all have dreams about the Perfect Code. And wonder of wonders, Microsoft really doesn’t know what we want to happen in Word, etc.

            I did get the check box to hide/unhide the text (easy), but, again it was for ease of use for some unsophisticated users. Thanks for setting me onto the best path.

            Errol

            • #747760

              As part of the hiding, you can apply font size and/or line-height formatting to make it all-but-invisible, if this would be easier for the users to understand. HTML/JavaScript is good for this sort of this, but I wouldn’t expect much more development along these lines in Word’s future. For all your form processing needs, Microsoft encourages you to move to InfoPath 2003. grin

            • #747764

              Microsoft can encourage all they want. Since I buy my own $oftware, I might just encourage myself to move to Star Office, if I don’t jump to Linux!

            • #747768

              Now that OpenOffice.org 1.1 / StarOffice 7.0 includes a macro recorder, I’m inclined to try it again. But… not this weekend. smile

            • #747769

              Now that OpenOffice.org 1.1 / StarOffice 7.0 includes a macro recorder, I’m inclined to try it again. But… not this weekend. smile

            • #747765

              Microsoft can encourage all they want. Since I buy my own $oftware, I might just encourage myself to move to Star Office, if I don’t jump to Linux!

            • #747761

              As part of the hiding, you can apply font size and/or line-height formatting to make it all-but-invisible, if this would be easier for the users to understand. HTML/JavaScript is good for this sort of this, but I wouldn’t expect much more development along these lines in Word’s future. For all your form processing needs, Microsoft encourages you to move to InfoPath 2003. grin

          • #747709

            Hans,

            We all have dreams about the Perfect Code. And wonder of wonders, Microsoft really doesn’t know what we want to happen in Word, etc.

            I did get the check box to hide/unhide the text (easy), but, again it was for ease of use for some unsophisticated users. Thanks for setting me onto the best path.

            Errol

        • #747703

          As I wrote, there is no document-level Before Print event, it is an application-level event, so it will occur whenever the user prints a document, not just this specific one. If you would like to use this event, the document about to be printed is passed as an argument in the DocumentBeforePrint event procedure, so you can test which one it is.

          I don’t think there is an objection to use a custom print button or menu item for printing this document. After all, it isn’t the usual printout the user will get.

          Alternatively, you could run a macro when a check box is clicked, to hide or unhide the selection it is in. If you display hidden text on screen, and do not print hidden text, you’d get the desired effect without having to do anything special when printing.

      • #747697

        Hans,

        Thanks for the tip. I may go that way. However, I’d like to make the description paragraphs available on the screen, and avoid printing them, if they’re not selected. (Otherwise we’ll be printing seven pages of useless information instead of, say, two pages.)

        Finally, rather than make the user run a macro (even in an attached button), they’d just print the thing with the usual print button (for transparency).

        How is it overkill?

        Errol

    • #747691

      Before Print is not an event of the Document object. The Application object has a DocumentBeforePrint event, but that may be overkill, since it will fire for all documents. Why not include ActiveDocument.PrintOut in the macro you already have?

    Viewing 1 reply thread
    Reply To: Reply #747761 in Printing or Hiding Sectors (Word 2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel