By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

vba code to open a register drawer??

P: n/a
ARC
I have a user asking if I could put in a code that will open a register
drawer. My understanding is the receipt printer will normally send the code
the cash drawer. Is there a vba function that someone can share that will
open a drawer without printing? Or does it depend on the drawer? I suppose
if it's just a sequence of characters, then it could be made customizable to
work for many different users. Any ideas?

Thanks!

Andy

Jan 18 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Fri, 18 Jan 2008 04:24:52 GMT, "ARC" <PC*****@PCESoft.invalid>
wrote:

Ask the register drawer company. They have every incentive to make it
as easy as possible for guys like you to integrate with their
hardware,
Last time I had to do this it was just a matter of sending some chars
out of the serial port.

-Tom.

>I have a user asking if I could put in a code that will open a register
drawer. My understanding is the receipt printer will normally send the code
the cash drawer. Is there a vba function that someone can share that will
open a drawer without printing? Or does it depend on the drawer? I suppose
if it's just a sequence of characters, then it could be made customizable to
work for many different users. Any ideas?

Thanks!

Andy
Jan 18 '08 #2

P: n/a
Here's a sample to make the printer port do what you want it to do. There
must be an easier way to talk to the IO ports (give me the old peek/poke
days) but haven't found it yet. I haven't tested this code completely yet,
but I'm sure it'll lead you in the right direction.

Public Sub open_cashdrawer()
Dim intFileNo As Integer = FreeFile()

FileOpen(1, "c:\escapes.txt", OpenMode.Output)
PrintLine(1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250))
FileClose(1)
Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus)
End Sub

The truth is though, every cash drawer is different. Either check the book
for the exact details, call the manufacturer or check out
http://pages.prodigy.net/daleharris/popopen.htm, there are many drawers in
there!!
Dominic
MS-Access Wizard of Oz-tralia,
"ARC" <PC*****@PCESoft.invalidwrote in message
news:oS******************@newssvr21.news.prodigy.n et...
>I have a user asking if I could put in a code that will open a register
drawer. My understanding is the receipt printer will normally send the code
the cash drawer. Is there a vba function that someone can share that will
open a drawer without printing? Or does it depend on the drawer? I suppose
if it's just a sequence of characters, then it could be made customizable
to work for many different users. Any ideas?

Thanks!

Andy

Jan 18 '08 #3

P: n/a
hmmm, or this is more VBA, sorry
Open "c:\escapes.txt" For Output As #1
Print #1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250)
Close #1

Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus)
Dominic

"Dominic Vella" <do***********@optusnet.com.auwrote in message
news:47***********************@news.optusnet.com.a u...
Here's a sample to make the printer port do what you want it to do.
There must be an easier way to talk to the IO ports (give me the old
peek/poke days) but haven't found it yet. I haven't tested this code
completely yet, but I'm sure it'll lead you in the right direction.

Public Sub open_cashdrawer()
Dim intFileNo As Integer = FreeFile()

FileOpen(1, "c:\escapes.txt", OpenMode.Output)
PrintLine(1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250))
FileClose(1)
Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus)
End Sub

The truth is though, every cash drawer is different. Either check the
book for the exact details, call the manufacturer or check out
http://pages.prodigy.net/daleharris/popopen.htm, there are many drawers in
there!!
Dominic
MS-Access Wizard of Oz-tralia,
"ARC" <PC*****@PCESoft.invalidwrote in message
news:oS******************@newssvr21.news.prodigy.n et...
>>I have a user asking if I could put in a code that will open a register
drawer. My understanding is the receipt printer will normally send the
code the cash drawer. Is there a vba function that someone can share that
will open a drawer without printing? Or does it depend on the drawer? I
suppose if it's just a sequence of characters, then it could be made
customizable to work for many different users. Any ideas?

Thanks!

Andy


Jan 18 '08 #4

P: n/a
ARC
Thanks, all!

As a little more info, I really don't want to make this specific to a
particular drawer (lots of users, shareware product), but somehow let them
configure the codes, then I just send what they put in, so hopefully it
would work with most drawers depending on the code they put in. Maybe a
config field in a setup table that holds the open codes.

Thanks again,

Andy
"Dominic Vella" <do***********@optusnet.com.auwrote in message
news:47***********************@news.optusnet.com.a u...
hmmm, or this is more VBA, sorry
Open "c:\escapes.txt" For Output As #1
Print #1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250)
Close #1

Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus)
Dominic

"Dominic Vella" <do***********@optusnet.com.auwrote in message
news:47***********************@news.optusnet.com.a u...
>Here's a sample to make the printer port do what you want it to do. There
must be an easier way to talk to the IO ports (give me the old peek/poke
days) but haven't found it yet. I haven't tested this code completely
yet, but I'm sure it'll lead you in the right direction.

Public Sub open_cashdrawer()
Dim intFileNo As Integer = FreeFile()

FileOpen(1, "c:\escapes.txt", OpenMode.Output)
PrintLine(1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250))
FileClose(1)
Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus)
End Sub

The truth is though, every cash drawer is different. Either check the
book for the exact details, call the manufacturer or check out
http://pages.prodigy.net/daleharris/popopen.htm, there are many drawers
in there!!
Dominic
MS-Access Wizard of Oz-tralia,
"ARC" <PC*****@PCESoft.invalidwrote in message
news:oS******************@newssvr21.news.prodigy. net...
>>>I have a user asking if I could put in a code that will open a register
drawer. My understanding is the receipt printer will normally send the
code the cash drawer. Is there a vba function that someone can share that
will open a drawer without printing? Or does it depend on the drawer? I
suppose if it's just a sequence of characters, then it could be made
customizable to work for many different users. Any ideas?

Thanks!

Andy


Jan 18 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.