?
Solved

Don't want ShowPrinter to change default printer

Posted on 2004-11-05
9
Medium Priority
?
399 Views
Last Modified: 2010-07-27
I have a VB6.0 SP6 app in which I use a ShowPrinter to allow the user to select the printer to direct output to.

It works great except for the fact that the users just informed me that not only does it re-direct the current output to the selected output device but also makes the new output device the default printer.

Is there a way (using showprinter or something else) to provide the ability to re-direct output without changing the default printer?

0
Comment
Question by:mlcktmguy
  • 6
  • 3
9 Comments
 
LVL 3

Expert Comment

by:pra_kumar03
ID: 12508111
Can you provide the code that you have put.
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 12508584
This is the code:

  cd1DescPrt.ShowPrinter

cd1DescPrt is a control dialog box on the form.
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 12526893
Anybody?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:pra_kumar03
ID: 12526954
what are you sending to the printer? anyhting like word doc? or reports ?
0
 
LVL 3

Expert Comment

by:pra_kumar03
ID: 12526969
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 12527003
I am sending two different things:

1. Reports Defined in the VB 6.0 'report writer'
2. PrintForm

Thanks
0
 
LVL 3

Expert Comment

by:pra_kumar03
ID: 12527220
try this
Dim sprinterpath As String
Dim sPrinter As Printer

sprinterpath = Printer.DeviceName
MsgBox sprinterpath
Me.CommonDialog1.ShowPrinter
For Each sPrinter In Printers
    If sPrinter.DeviceName = sprinterpath Then
        Set Printer = sPrinter
        Exit For
    End If
Next
0
 
LVL 3

Accepted Solution

by:
pra_kumar03 earned 2000 total points
ID: 12527268
if the above doesn't work then try this
http://support.microsoft.com/default.aspx?scid=kb;EN-US;266767
0
 
LVL 3

Expert Comment

by:pra_kumar03
ID: 12527364
hi
I tried the the simplest code of using the set printer but that does not work. I looked up some KB articles and it seems that won;t work after all. All articles did tell to use the KB 266767 of Microsoft to attain the same.
So you may go ahead and use that info and get the default printer name first then print the stuff on the specified printer and then set the default printer back.
That is the only soln i m able to think right now.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

862 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