Hello all! I wanted to share this quick tutorial to help anyone out who might be struggling with this same procedure.
I will list what my setup is below and you can adapt it from there. Note that I am in no way an expert and quite frankly, am relatively new at this. With that said...
My Setup
When I plugged in my Adapter I made sure to have it connected to the register.
The driver should come up as a "Prolific USB-to-Serial Comm Port (Your Com Port Here)" ***Remember which COM Port it says.
The following code is what I used to pop the drawer right open:
Private Sub OpenCashDrawer()
On Error GoTo Errorhandler
Dim LocationPort As String
LocationPort = "Com4" 'Replace Com4 with the com port you are using. Example is Com3, Com2, etc.....
Open LocationPort & ":9600,n,8,1" For Output As #1
Print #1, "" 'This is just sending a signal like it is printing something but it is not.
Close #1
Exit Sub
Errorhandler:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
VBE.ActiveCodePane.CodeModule, vbCritical, "Error in btnOpenCashDrawer_Click"
End Sub
This worked for me, so I hope this helps someone out.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)