Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Paragould, Arkansas, USA
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing or Hiding Sectors (Word 2K)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    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?

  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Paragould, Arkansas, USA
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    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.

  5. #5
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Paragould, Arkansas, USA
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    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

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    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. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  7. #7
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Paragould, Arkansas, USA
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    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!

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Printing or Hiding Sectors (Word 2K)

    Now that OpenOffice.org 1.1 / StarOffice 7.0 includes a macro recorder, I'm inclined to try it again. But... not this weekend. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •