tmorgan2512
MIS
- Nov 18, 2008
- 5
I am trying to code a vb app written in VB6 to print to a specific printer. I wrote a pretty simple version of the app just to test this functionality. The app is run from a Win2K3 server and tries to print the text "123" to the network printer \\print_server\ITSystems1.
The probelem I have is that, when I run the app it prints to whatever the default printer is set to on the server and not to where I want it to go. (\\print_server\ITSystems1)
Any thoughts?
Private Sub main()
printer_selected = "\\print_server\ITSystems1"
Printer.Print "123"
Call setPrinter
End Sub
Private Sub setPrinter()
For Each p In Printers
If prefixEqualsIgnoreCase(p.DeviceName, printer_selected) Then
Set Printer = p
Else
End If
Next
End Sub
Public Function prefixEqualsIgnoreCase(s1 As String, s2 As String) As Boolean
prefixEqualsIgnoreCase = True
If UCase(Left(s1, Len(s2))) <> UCase(s2) Then prefixEqualsIgnoreCase = False
End Function
Thanks
The probelem I have is that, when I run the app it prints to whatever the default printer is set to on the server and not to where I want it to go. (\\print_server\ITSystems1)
Any thoughts?
Private Sub main()
printer_selected = "\\print_server\ITSystems1"
Printer.Print "123"
Call setPrinter
End Sub
Private Sub setPrinter()
For Each p In Printers
If prefixEqualsIgnoreCase(p.DeviceName, printer_selected) Then
Set Printer = p
Else
End If
Next
End Sub
Public Function prefixEqualsIgnoreCase(s1 As String, s2 As String) As Boolean
prefixEqualsIgnoreCase = True
If UCase(Left(s1, Len(s2))) <> UCase(s2) Then prefixEqualsIgnoreCase = False
End Function
Thanks