Results 1 to 10 of 10
  1. #1
    5 Star Lounger Lou Sander's Avatar
    Join Date
    Jun 2002
    Location
    Pittsburgh, PA
    Posts
    855
    Thanks
    140
    Thanked 10 Times in 9 Posts

    Non-printing Macro Button (2003)

    I have an occasionally-printed document that needs to be printed to a specific non-default printer. If it prints on my default printer, it doesn't come out right.

    I can print the document to the right printer, IF I do it by clicking a custom button on my toolbar. But it's easy to forget this and click the default printing button instead, which reminds me of my error by printing my document to the wrong place. I've tried putting a macrobutton on the document itself. That's a sufficient reminder to get me to click it, but so far the button itself prints along with the document, which I don't want.

    How can I put a non-printing macrobutton on the document?
    Lou Sander
    Pittsburgh, Pennsylvania
    USA

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

    Re: Non-printing Macro Button (2003)

    You can format the macrobutton as Hidden (in the Format | Font dialog). If you display hidden text on screen, but don't print it, you're good to go.

  3. #3
    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: Non-printing Macro Button (2003)

    This might create other hassles (macro warnings), but you could create a FilePrintDefault macro in your document that overrides the default button and runs your custom macro.

  4. #4
    5 Star Lounger Lou Sander's Avatar
    Join Date
    Jun 2002
    Location
    Pittsburgh, PA
    Posts
    855
    Thanks
    140
    Thanked 10 Times in 9 Posts

    Re: Non-printing Macro Button (2003)

    Hans: I don't think the hidden text method will help me, as I typically do not display hidden text. If it's not displayed when I open this document, I won't see it.

    Jscher: That might work, as might a macro that displays hidden text when the document is opened. I've done it before long ago, but I don't remember how to make a macro that runs when a document is opened. If you can give me some guidance on that, I'll experiment and report back.

    I had thought of putting my macrobutton at the extreme margin (where the printer can't print), but that just gets me some margin warnings.
    Lou Sander
    Pittsburgh, Pennsylvania
    USA

  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: Non-printing Macro Button (2003)

    I write from a computer without Office... to run code when a document opens, you have two options:

    (1) In the ThisDocument module, and procedure that runs in response to an event with a name similar to DocumentOpen (check the drop-down above the code area)
    (2) In the ThisDocument module or in any code module, a procedure named AutoOpen

    I think it's a good idea to always display hidden text. Fewer surprises that way. <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

    (I still think a custom FilePrintDefault macro will be easier...)

  6. #6
    5 Star Lounger Lou Sander's Avatar
    Join Date
    Jun 2002
    Location
    Pittsburgh, PA
    Posts
    855
    Thanks
    140
    Thanked 10 Times in 9 Posts

    Re: Non-printing Macro Button (2003)

    I have a lot of custom macros, but it's been years since I set them up, so my macro skills are stale.

    Can you explain a bit more about a custom FilePrintDefault macro? I'm guessing that it changes the default printer for this document only. That would be most excellent.
    Lou Sander
    Pittsburgh, Pennsylvania
    USA

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

    Re: Non-printing Macro Button (2003)

    FilePrintDefault is the name of the built-in command that is executed when you click the default Print button on the Standard toolbar.
    If you create a macro named FilePrintDefault in a module in a document, this macro will override the built-in command in that document only; in all other documents the built-in command will be executed.

  8. #8
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Non-printing Macro Button (2003)

    If you only use the macro button once (and always use it once) prior to printing, you can add code to its click event to have it disappear once the macro has run. This may or may not suit your situation of course.

    Alan

  9. #9
    5 Star Lounger Lou Sander's Avatar
    Join Date
    Jun 2002
    Location
    Pittsburgh, PA
    Posts
    855
    Thanks
    140
    Thanked 10 Times in 9 Posts

    Re: Non-printing Macro Button (2003)

    It is doing exactly what I want it to now. Thanks to all for their help.

    Whether I click the toolbar's "special printer" icon or its default print icon, my special document prints to the special printer.

    I attached this macro to the special document. It's something I wrote long ago to use for printing to different specific printers:

    Sub FilePrintDefault()
    '
    ' Makes the toolbar Print icon print to the K850 printer
    ' then resets it to the LaserJet 1300
    ' Macro originally recorded 12/23/2006 by Louis F. Sander
    ' Put to this purpose on 1/31/2007
    '
    ActivePrinter = "3 - ENVELOPE (HP Officejet Pro K850)"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
    wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
    ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
    False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
    PrintZoomPaperHeight:=0
    ActivePrinter = "1 - LASER (HP LaserJet 1300)"
    End Sub

    I got an unwanted macro warning when I used it, but I set my macro security to Low (against Microsoft's advice). I've got Norton Antivirus and I hardly ever get Word documents from elsewhere, so I suppose I'm fairly safe.
    Lou Sander
    Pittsburgh, Pennsylvania
    USA

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

    Re: Non-printing Macro Button (2003)

    You can sign your VBA project with a digital signature. If it's for your own use only, you can use SelfCert to create one. See Macro Security Levels in Office 2003.

Posting Permissions

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