I am currently using VB6 with SP6 installed. I have the Component One add-on also installed. I am using the VSPRINT object to preview/print out a report. There are two basic types of printers that I use.
The two types are:
1 - 8 1/2 inch x 11 inch
2 - 3 inch Receipt Continious
I want to be able to set the default printer temporarily within code so that I can have the report program print to the appropriate printer needed by the specific report that is being requested.
I have this code already there
Public Function SetPrinter(ByVal DeviceName As String) As Boolean
Dim X As Printer
If Printers.Count > 0 Then
For Each X In Printers
MsgBox (X.DeviceName)
If InStr(LCase(X.DeviceName), DeviceName) Then
MsgBox ("Set " & X.DeviceName & " as default printer")
Set Printer = X
SetDefaultPrinter = True
Exit For
End If
Next X
End If
End Function
but even though it shows that the current device set is 8 1/2inch by 11 inch style printer when it goes to the preview it shows it as the default printer which in some cases is quite possible to be the 3inch receipt printer. Therefore if it is the 3inch style it does not display correctly and also when it is told to print it prints to the default printer even though the code above is set such that the default printer within the program should be the one with MAIN in its name which will be the 8 1/2 inch x 11 inch printer.
ANy suggestions or ideas?
Thanks in advance for your help in this.
Seasons Greetings & God Bless to you and yours.![]()


Reply With Quote
Thanks.

been looking for this for days