erocm
01-10-2003, 09:14 AM
Ok guys here it is....
Private Sub OpenDrawerLPT()
Dim TempPort As String
Dim DefaultPrinter As Object
Dim P As Object
TempPort = "LPT" & piPort & ":"
For Each P In Printers
If P.Port Like TempPort Then
Set DefaultPrinter = Printer
Set Printer = P
Printer.Print "OPENSESAME"
Set Printer = DefaultPrinter
Exit For
End If
Next P
End Sub
Let me explain what I am doing now....
I have a cash drawer that I need to send OPENSESAME to get it to open on my command. I need to control which printer port it is going to.... ie lpt1 lpt2 etc
I was told that I needed to set the printer I wanted to use as the default but I had to store the default first then put it back after I am done so it retains the default.
I am getting jiberish for one... using generic plain text printer driver and then it also says that Runtime Error Type Mismatch 13 on "Set Printer = DefaultPrinter".
Is there a simplier way to do this?
Thanks as usual,
Eroc
Private Sub OpenDrawerLPT()
Dim TempPort As String
Dim DefaultPrinter As Object
Dim P As Object
TempPort = "LPT" & piPort & ":"
For Each P In Printers
If P.Port Like TempPort Then
Set DefaultPrinter = Printer
Set Printer = P
Printer.Print "OPENSESAME"
Set Printer = DefaultPrinter
Exit For
End If
Next P
End Sub
Let me explain what I am doing now....
I have a cash drawer that I need to send OPENSESAME to get it to open on my command. I need to control which printer port it is going to.... ie lpt1 lpt2 etc
I was told that I needed to set the printer I wanted to use as the default but I had to store the default first then put it back after I am done so it retains the default.
I am getting jiberish for one... using generic plain text printer driver and then it also says that Runtime Error Type Mismatch 13 on "Set Printer = DefaultPrinter".
Is there a simplier way to do this?
Thanks as usual,
Eroc