DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Ask code set printer for the report ?

  1. #1
    Join Date
    Mar 2008

    Ask code set printer for the report ?

    Assuming the computer has installed 2 printer name: printer1, printer2 and in my program has 4 report name: ActiveReport1, ... ActiveReport4. Status to avoid crafted before viewing or printing in the printer before you have to choose, I can write code automatically select the printer before printing or print view, for example, when prints ActiveReport odd numbers will viewed or print on printer1 and ActiveReport even numbers when viewed in print or on printer2. for example code this.

  2. #2
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Assuming you wish to change the default printer, try something like this
    Option Explicit
    Private Declare Function SetDefaultPrinter Lib "winspool.drv" _
    Alias "SetDefaultPrinterA" (ByVal pszPrinter As String) As Long
    Private myPrinter As String
    Private Sub Command1_Click()
    CommonDialog1.ShowPrinter 'set another printer to be default
    End Sub
    Private Sub Form_Load()
    myPrinter = Printer.DeviceName 'store existing default printer name
    End Sub
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    SetDefaultPrinter myPrinter 'reset to default printer on exit
    End Sub

Similar Threads

  1. Replies: 1
    Last Post: 12-31-2004, 10:50 AM
  2. Printer the report to certain length
    By anonymous in forum VB Classic
    Replies: 0
    Last Post: 05-30-2003, 06:50 AM
  3. Printer width from data report
    By Dave in forum VB Classic
    Replies: 0
    Last Post: 07-31-2001, 05:01 PM
  4. Data Report (Printer Orientation)
    By Joseph V. Marcelo in forum VB Classic
    Replies: 2
    Last Post: 07-22-2000, 12:28 PM
  5. Replies: 1
    Last Post: 03-31-2000, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center