Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Send a single word dockument to multiple printers

I have an application that builds word docs with a predefined template.
Inside the template are bookmarks that are populated with information taken from a SQL database at the time the document is generated.

My customer is requesting that we print this output twice - once to a printer in sales and once to a printer in shipping.

The single doc prints fine. I just need this to print to 2 different printers from a single generation.
We are using Word 2000
HP 4100
HP 8000DN
0
pattersonr
Asked:
pattersonr
  • 3
  • 3
1 Solution
 
pauloaguiaCommented:
File -> Print -> (Choose HP 4100)
File -> Print -> (Choose HP 8000DN)

Simple, no? :)


Now seriously. I think this macro in the ThisDocument module will do the trick:

Sub printTwo()
    Application.ActivePrinter = "HP 4000"
    ThisDocument.PrintOut Background:=True, Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=1, PageType:=wdPrintAllPages
    Application.ActivePrinter = "HP 8000DN"
    ThisDocument.PrintOut Background:=True, Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=1, PageType:=wdPrintAllPages
End Sub

Hope this helps

Paulo
0
 
pauloaguiaCommented:
(or any other module fot that matter)
0
 
pattersonrAuthor Commented:
Paul...Cannot get macro to work from template.
I am assuming that macro is not working due to the fact that the macro is placed in the template.  When The information is populated into the template it then becomes a new document based on that template.  Then the document that is created is printed and saved.

I think that the macro is not working due to the fact that the macro does not carry through to the new document that is created.  Any other suggestions...or ways to carryover the macro to the new document. ???
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
DreamboatCommented:
Yep. Prolly need "activedocument" dontcha?

Patterson: I think you could easily record this macro, and when you go to do so, store it in the template, no?
0
 
pattersonrAuthor Commented:
Got the code that I was looking for.  I had to make several changes.  But, this was what put me on the right track
0
 
pauloaguiaCommented:
Thanks for the points. I must appologize for not replying to you (I don't remember why but I'm sure there was a good reason). Glad you could make it on your own just the same :)
 
Also maybe you could post the code you got. It may help someone else with a similar problem in the future.

Paulo
0
 
pattersonrAuthor Commented:
Public doPrint As Boolean

Public Sub printSecond()


    Application.ActivePrinter = "Acctg8000DN"
    Application.ActiveDocument.PrintOut Background:=True, Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=1, PageType:=wdPrintAllPages
    Application.ActivePrinter = "Acctg8000DN"
    Application.ActiveDocument.PrintOut Background:=True, Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent, Copies:=1, PageType:=wdPrintAllPages

End Sub

Private Sub Document_New()
    doPrint = True
End Sub

Private Sub Document_Open()
    doPrint = False
End Sub

Private Sub Document_Close()
    If doPrint Then
        Call printSecond
    End If
End Sub

We also added in a timer to delay the printing of the second document. However, we felt that this wasnt realy helping anything so we took it out.  This particular code was added so that when a user opened a saved copy that it did not reprint.  Hope this helps someone
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now