Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Aug 2001
    Location
    Shropshire, UK
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Preventing controls printing (Word97sr2 VBA)

    This is probably a dumb question, but how can you prevent a button on a document from printing? I can find the property on Excel sheets but seem unable to set it in Word.

  2. #2
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Preventing controls printing (Word97sr2 VBA)

    Basically, you want users to be able to view a doc - but not print it?

    I had a similar question recently - also, they wanted to prevent copy/paste.

    I'm curious to hear the experts answer this.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  3. #3
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Willow Grove, Pennsylvania, USA
    Posts
    205
    Thanks
    4
    Thanked 49 Times in 40 Posts

    Re: Preventing controls printing (Word97sr2 VBA)

    Just so happens it's in the FAQ... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    <A target="_blank" HREF=http://www.mvps.org/word/FAQs/TblsFldsFms/HidePrintButton.htm>http://www.mvps.org/word/FAQs/TblsFldsFms/...PrintButton.htm</A>

  4. #4
    Lounger
    Join Date
    Aug 2001
    Location
    Shropshire, UK
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing controls printing (Word97sr2 VBA)

    Thanks for the replies. I think i need to explain a bit more...
    I'm generating a multi-choice exam using an excel database of questions and responses. A VBA routine randomly selects a requested number of unique questions and scrambles the answers. A Word doc is used to hold the questions and answers, plus any graphic and the correct response. So the whole list of questions would be in the format:-

    Some question here?
    Response A goes here
    Response B goes here
    Response C goes here
    Response D goes here
    Correct reponse is: A - D

    The questions are formated as Heading 1style, the choices as Heading 2 style and the correct response para (which also holds any inline graphic) as Heading 3 style. Headings 1 and 2 are set up to outline number and Heading 3 has no number but does have a bottom border. The whole thing works very well, with all questions and responses automatically numbering and lettering plus any graphics below the last reponse being exactly the same width as the column. To toggle between hiding and showing the correct answers i placed a toggle button at the top of the first page to switch the font colour of the Heading 3 style between white and auto.

    I checked the FAQ and the text box technique is intresting (if a pain in the ass) but it assumes i want a button for printing. To get the sample code to work i would need to place a button on the document for printing. I even checked for event procedures like Before_print in excel, but no luck. All these things that are in one App but not another is enough to drive you <img src=/S/nuts.gif border=0 alt=nuts width=15 height=15> !!

  5. #5
    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: Preventing controls printing (Word97sr2 VBA)

    Okay, this really is cheating, but... how about putting a section break after the button and then only printing Section 2? I have a couple different automated Word solutions where the first section is data collection and plumbing, and Section 2 is the beautiful result.

    If that doesn't work for you, how about hidden text? I am used to viewing hidden text, so it seems quite natural to me to use the hidden text attribute for that paragraph so it doesn't print. However, I don't know whether your users view hidden text. If not, they won't see the button. This could be toggled in a Document_New or Document_Open macro, if you don't mind messing with the user's settings. (Storing the original value to restore on close is not a perfect solution because the user might work with other documents while your document is open...)

    All I can think of at the moment.

  6. #6
    Lounger
    Join Date
    Aug 2001
    Location
    Shropshire, UK
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing controls printing (Word97sr2 VBA)

    I've decided to use a check box. It's more discrete than some big grey toggle button and doesn't require playing around with user settings (which can upset some!!) or putting buttons on the document to specifically hide controls during printing/print certain sections. I am assuming there is no equivalent to a print range in Excel, where once you name it you can leave it alone.
    Thanks for the input everyone,
    Ewan
    P.S. Could start a whole new thread on features in one office app that should be in the others!!

  7. #7
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Preventing controls printing (Word97sr2 VBA)

    Ewan,

    If you have the option to use Word 2000, you can take advantage of the application-level DocumentBeforePrint event (don't think that existed in Word 97).

    Gary

Posting Permissions

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