Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print and closing a Word document via macro? 1

Status
Not open for further replies.

sobeitjedi

IS-IT--Management
Jul 25, 2006
4
GB
Hi.

Please could someone help with a macro I require.

I want Word 2003 to print the open document and close Word down. The print out needs print out to a particular printer and needs to be black & white and single sided (not duplex).

When printing the document, I get asked a question about printing outside the margins of the page or something. I always answer YES to this.

Is this possible?
 
Code:
Sub pnumb(n):
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=pn, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0

Application.Quit SaveChanges:=wdPromptToSaveChanges

End Sub
will print pn copies (change to a 1 maybe)

this will quit Word but if you only want close the doc(record marco and look at it) use a .Close . Quit is not so easy to record!

there is a tide in the affairs of man that you Canute ignore.................
 
I've run the macro on the document I wish to apply this marco to, but Word stays open with a dialog box saying "Please wait while Word finishes all pending print jobs". The print job is "spooling" but never prints out. My only option it seems is to press the "Cancel Printing" button on the dialog box.

Any ideas?
 
Replace this:
Background:=True
with this:
Background:=False

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Great, it's now printing but it's printing off on each side of the page (duplex).
 
funny that - maybe the print driver. We use a HP Inkjet 2800 Word 2002 Win Xp and it prints as listed.

I would counsel using the record function. It is not 100% in that some macros it generates do not work as recorded but it does alert you to how it does most simple things and a few complicated ones.

there is a tide in the affairs of man that you Canute ignore.................
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top