Results 1 to 10 of 10
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Southern Highlands, New South Wales, Australia
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print Shortcut (W2000Win98)

    Can you tell me please how I would set up a desktop shortcut to print a Word document. The facility is for the "technology challenged" in the office who have great difficulty following instructions. I just want them to be able to click on the shortcut and it will automatically send 10 copies of the document to the colour laser printer. (I always want it to print 10 and it always must be to the colour laser). I do run a small (3 machines) network and the document is on one machine but the printer is a shared local printer attached to a different machine. I guess it probably is just a shortcut to a .bat file which will then send the document off but how do I do it?
    Cheers
    John

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    I had to do something very similar about a year ago with Excel. I did some major tweaking to make my macro do what you need in Word, and I hope this helps!

    Create a Word template file and create a new macro named AutoOpen (the name is actually very important-it makes the macro run when the template is opened). Create a shortcut to this new macro on the user's desktop.

    The code below is what I used when I created this macro as a test. You'll have to change the "ChangeFileOpenDirectory", the "FileName", and the "ActivePrinter" to match your environment, and the macro should make Word close itself when it's all done running.

    This worked for me, but I'm using all networked printers. Let me know how this works! <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

    Becky

    <hr>Sub AutoOpen()
    '
    ' AutoOpen Macro
    ' Macro recorded 6/26/02 by Becky
    '
    ChangeFileOpenDirectory "D:"
    Documents.Open FileName:="Print.doc"
    ActivePrinter = "PrintServercolorname"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
    wdPrintDocumentContent, Copies:=10, Pages:="", PageType:=wdPrintAllPages
    Application.Quit
    End Sub<hr>

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Southern Highlands, New South Wales, Australia
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    Hi Becky, thanks ever so much for your advice.
    However, as a macro newbie I am having difficulty. Your code of "Item:=_" where the last character looks to me like an underscore, is rejected by the compiler with "Invalid Character". If I leave the underscore out I get "Compile Error. Expected Expression". I had a look in the Help file but was none the wiser. Any clues?
    Also, I saved the macro (called it AutoOpen) and saved the document I had it in as a template. However whenever I opened Word the macro would try to run every time. This I suppose seems logical as it is an AutoOpen macro but will create havoc if every time I start Word I print 10 copies of the document!
    Ciao for now.
    John

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

    Re: Print Shortcut (W2000Win98)

    The undercore _ is the continuation character in VBA. It indicates that the instruction will be continued on the next line. There needs to be a space between the last part of the instruction on the first line, in this case Item:=, and the underscore (the space is there in Becky's post).

    You probably saved your macro by accident in Normal.dot instead of in the template you created. Open your template in Word. In the Visual Basic Editor, look at the project explorer. Expand both Normal.dot and your template. If there is no Modules item under your template, it contains no macros. Look in Modules under Normal.dot. If there is more than one module, open each to find out which one contains the AutoOpen macro. Drag that module to your template. Verify that is has been copied. Then, point to the module in Normal.dot and delete it (File/Delete ... or right click on module, Delete ...). If you are asked whether you want to export it before deleting, answer No.

  5. #5
    Star Lounger
    Join Date
    Feb 2001
    Location
    Southern Highlands, New South Wales, Australia
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    Hello Becky, You asked me to let me know how I got on with your macro so I write to tell you that I have not been able to get it working. And no I haven't been working on it for all this time!!! I just do a bit of it when I get the chance which, obviously, is not that often! I keep on getting "Expected Expression" in the line Range:=wdPrintAll Document, Item:= _
    wdPrintDocumentContent, Copies:=10, Pages:="" (I have cut and pasted this line from the macro). The Help option implies that the error is to the left of the first equals sign!
    I would appreciate any help you could provide. Cheers John

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

    Re: Print Shortcut (W2000Win98)

    Range:=wdPrintAllDocument, ... is not an instruction by itself, it's part of the Application.Printout instruction:

    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, _
    Copies:=10, Pages:="", PageType:=wdPrintAllPages

    There can be continuation characters _ in the instruction, but it must not be broken up in other ways.

    Several of the arguments are superfluous because they have the default value. You can shorten it to

    Application.PrintOut FileName:="<your file name>", Copies:=10

    where you must replace <your file name>" by the path+filename of the document you want to be printed.

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    Hi John:
    Not to complicate things, but there is an alternative to naming the macro AutoOpen. You can give it any name (say PrintTen). Then, when you create a shortcut to the document, e.g. on the desktop, go to Properties for the shortcut (select the file & press Alt+Enter in Windows Explorer). Then put the following in the command line on the shortcut tab:

    "C:Program FilesMicrosoft OfficeOfficeWINWORD.EXE" "C:FileName.doc" /mPrintTen

    where FileName.doc is the name of your file. Also, make sure that the path in the first quote is the path to your winword.exe. This command line, with switches, will open your file & the /m switch tells it to run a macro based on the attached template.

    I know that this advice won't help get your macro working, but it does mean that it won't run every time you open your template. On the other hand, I agree with Hans that you probably saved the macro in normal.dot. My solution above is only useful if you want to have a choice when you open your template. It will allow you to open your template, or document based on a template, without printing 10 copies. You would then use the shortcut when you wanted to print 10 copies.

    Cheers,

  8. #8
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    John,

    Have you gotten this to work yet?

    Just checking...
    Becky

  9. #9
    Star Lounger
    Join Date
    Feb 2001
    Location
    Southern Highlands, New South Wales, Australia
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    Hi Becky, Well........ I have admitted defeat! The reply I got from HasV enabled me to get the macro to run but when it did I got a "Stack Full" message. When I checked out the Help option for this message, I really was none the wiser! So when I answered OK to the "stack" message I would then get "There is a problem writing to the printer" (which may be caused by the stack problem, but I don't know). So, I won't be spending any more time on it. I've set up a shortcut on the desktop to open the document and I'll just manually send it to the printer after changing the number of copies to 10! Thanks for your help and thanks to the others for their help to. Cheers, John.

  10. #10
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Shortcut (W2000Win98)

    You could try this little script.
    Put this code in a file with .vbs extension then create an icon for it on your desktop.

    dim aWord
    set aWord = WScript.CreateObject("Word.Application")
    aWord.Documents.Open("C:WordDocument.doc")
    aWord.Activedocument.PrintOut 0,0,0,"","","",0,10,"",0,0,1,""
    aWord.quit
    set aWord = nothing
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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