Ask code set printer for the report ?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Ask code set printer for the report ?

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    110

    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
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Assuming you wish to change the default printer, try something like this
    Code:
    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
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 1
    Last Post: 12-31-2004, 09: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, 04: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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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