Changing Printers property reset printer to Windows default printer 
Author Message
 Changing Printers property reset printer to Windows default printer

I 've got the following problem. (Visual Basic version 5.0)

First I choose a printer from the printers collection, not being the windows
default printer.
Then I start changing the printers properties such as the papersize.
After that the printer is changed back to the windows default printer again.
what do I have to do to prevent this from happening??

Here's my code:

Dim newprinter As Printer

For Each newprinter In Printers
   If newprinter.DeviceName = "Epson MX-80" Then
     Set Printer = newprinter
     Exit For
  End If
Next newprinter

a = Printer.DeviceName

Printer.PapeSize = vbPRPSA4

b = Printer.DeviceName

After running this code a is "Epson MX-80"
 and b = "HP Laserjet 4L" being my Windows default printer.

Any ideas?

Thanks...



Sat, 17 Jul 2004 22:24:01 GMT  
 Changing Printers property reset printer to Windows default printer
You just set Printer object properties for your application.
To change windows default printer you need to use some API.
Also, changes you make such a paper size not going to be saved. Again, you
need to use some API. (or maybe manually edit registry  and/or .INI file)


Quote:
> I 've got the following problem. (Visual Basic version 5.0)

> First I choose a printer from the printers collection, not being the
windows
> default printer.
> Then I start changing the printers properties such as the papersize.
> After that the printer is changed back to the windows default printer
again.
> what do I have to do to prevent this from happening??

> Here's my code:

> Dim newprinter As Printer

> For Each newprinter In Printers
>    If newprinter.DeviceName = "Epson MX-80" Then
>      Set Printer = newprinter
>      Exit For
>   End If
> Next newprinter

> a = Printer.DeviceName

> Printer.PapeSize = vbPRPSA4

> b = Printer.DeviceName

> After running this code a is "Epson MX-80"
>  and b = "HP Laserjet 4L" being my Windows default printer.

> Any ideas?

> Thanks...



Sat, 17 Jul 2004 22:36:00 GMT  
 Changing Printers property reset printer to Windows default printer
This is not what I mean.

I don't want to make changes to the Windows default printer, but I want to
print on a not windows default printer. When I change to that not default
printer, it seems to go all right. But when I start to make changes to the
chosen printer, it changes back to the windows default printer.

Quote:

>You just set Printer object properties for your application.
>To change windows default printer you need to use some API.
>Also, changes you make such a paper size not going to be saved. Again, you
>need to use some API. (or maybe manually edit registry  and/or .INI file)



>> I 've got the following problem. (Visual Basic version 5.0)

>> First I choose a printer from the printers collection, not being the
>windows
>> default printer.
>> Then I start changing the printers properties such as the papersize.
>> After that the printer is changed back to the windows default printer
>again.
>> what do I have to do to prevent this from happening??

>> Here's my code:

>> Dim newprinter As Printer

>> For Each newprinter In Printers
>>    If newprinter.DeviceName = "Epson MX-80" Then
>>      Set Printer = newprinter
>>      Exit For
>>   End If
>> Next newprinter

>> a = Printer.DeviceName

>> Printer.PapeSize = vbPRPSA4

>> b = Printer.DeviceName

>> After running this code a is "Epson MX-80"
>>  and b = "HP Laserjet 4L" being my Windows default printer.

>> Any ideas?

>> Thanks...



Sun, 18 Jul 2004 00:24:03 GMT  
 Changing Printers property reset printer to Windows default printer
why not make the changes to the printer first (papersize, etc.) then change
the actual printer.  actually, vbPRPSA4 is 210mm x 297mm, while the paper in
hour HP is 215.9mm x 279.4mm.  thus if you can constrain yourself to not
print past the 210 width point and can stand leaving a .7 inch margin at the
bottom of your paper, you don't need to change the size at all.  print away.

-d


Quote:
> This is not what I mean.

> I don't want to make changes to the Windows default printer, but I want to
> print on a not windows default printer. When I change to that not default
> printer, it seems to go all right. But when I start to make changes to the
> chosen printer, it changes back to the windows default printer.


> >You just set Printer object properties for your application.
> >To change windows default printer you need to use some API.
> >Also, changes you make such a paper size not going to be saved. Again,
you
> >need to use some API. (or maybe manually edit registry  and/or .INI file)



> >> I 've got the following problem. (Visual Basic version 5.0)

> >> First I choose a printer from the printers collection, not being the
> >windows
> >> default printer.
> >> Then I start changing the printers properties such as the papersize.
> >> After that the printer is changed back to the windows default printer
> >again.
> >> what do I have to do to prevent this from happening??

> >> Here's my code:

> >> Dim newprinter As Printer

> >> For Each newprinter In Printers
> >>    If newprinter.DeviceName = "Epson MX-80" Then
> >>      Set Printer = newprinter
> >>      Exit For
> >>   End If
> >> Next newprinter

> >> a = Printer.DeviceName

> >> Printer.PapeSize = vbPRPSA4

> >> b = Printer.DeviceName

> >> After running this code a is "Epson MX-80"
> >>  and b = "HP Laserjet 4L" being my Windows default printer.

> >> Any ideas?

> >> Thanks...



Sun, 18 Jul 2004 01:31:52 GMT  
 Changing Printers property reset printer to Windows default printer
I have found the solution. It appeared to be a bug in Visual Basic 5.0.
After installing Service Pack 3 my problem was gone, as well as some other
less important problems I had.

Thanks for thinking with me...

Jacob Waterweg



Tue, 20 Jul 2004 17:02:15 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Problem setting the active printer of Word 97 without changing the Windows default printer

2. Macro to change default printer and then restore original default printer settin

3. Macro that selects printer and prints doc also changes default printer

4. Using Printer common dialog changes default printer

5. How To Get Printer Dialog Not to Change Default Printer

6. printer default to non-default printer

7. Changing Default Printer Properties

8. Changing printer default properties

9. Changing default printer/properties in NT?

10. How to change default printer's Property.

11. Changing default printer/properties in NT?

12. Changing windows default printer on the fly

 

 
Powered by phpBB® Forum Software