macro to run dos command

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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