Solved

Default printer program

Posted on 1998-12-09
1
143 Views
Last Modified: 2010-05-18
I am looking for sample VB program: to set up default printer for printouts. Please, help.
0
Comment
Question by:iriska
1 Comment
 
LVL 3

Accepted Solution

by:
jjbyers earned 50 total points
ID: 1449075
use the commondialog control to set the printer properties.

This is straight out of VB5 help

Private Sub Command1_Click()
    Dim BeginPage, EndPage, NumCopies, i
    ' Set Cancel to True
    CommonDialog1.CancelError = True
    On Error GoTo ErrHandler
    ' Display the Print dialog box
    CommonDialog1.ShowPrinter
    ' Get user-selected values from the dialog box
    BeginPage = CommonDialog1.FromPage
    EndPage = CommonDialog1.ToPage
    NumCopies = CommonDialog1.Copies
    For i = 1 To NumCopies
        ' Put code here to send data to the printer

    Next i
    Exit Sub
ErrHandler:
    ' User pressed the Cancel button
    Exit Sub
End Sub

Hope this helps.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question