macro to run dos command

geno607

New Member
Joined
Apr 23, 2018
Messages
8
any idea how to create a macro to run a dos command to open a cash drawer?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Welcome to the forum. :)

You can usually use Shell to do that. What is the DOS command?
 
Upvote 0
You can probably use something like this:

Code:
Shell "Cmd /k echo ^G > COM4", vbhide
 
Upvote 0
You can probably use something like this:

Code:
Shell "Cmd /k echo ^G > COM4", vbhide

I appreciate the help, I copied that and pasted that into the macro, it doesnt run.
I think the problem is that ^G it has to be done in with the crtl button pressed with the letter G.
dos doesn't recognize it with the
when I do that in the macro it wont recognize that key stroke.

http://www.starmicronics.com/absolu...icronics_CashDrawer_OpenFromCommandPrompt.pdf

here is the info from star micronics for the command to open the drawer. I really appreciate any help.
I have created a spread sheet to use for the cash control report for the end of day. one of the buttons needs to open the cash drawer
 
Upvote 0
I can't test, but does this work?

Code:
Shell "Cmd /k echo " & chr(7) & " > COM4", vbhide
 
Upvote 0
Cmd runs the command prompt.
The rest is the same as you would type at the command prompt, other than the ^G can't be typed as a literal ^ sign followed by a G, it's actually (according to my searches) equivalent to the ASCII character code 7, which is what the Chr(7) part recreates.
 
Upvote 0
Cmd runs the command prompt.
The rest is the same as you would type at the command prompt, other than the ^G can't be typed as a literal ^ sign followed by a G, it's actually (according to my searches) equivalent to the ASCII character code 7, which is what the Chr(7) part recreates.


Thanks again, I knew I had stopped at the right place. So many avenues on the net. Appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,214,893
Messages
6,122,118
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top