ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to activate a Batch file ! (https://www.excelbanter.com/excel-programming/279375-macro-activate-batch-file.html)

Tarek[_2_]

Macro to activate a Batch file !
 
i've just installed a cash drawer for my grocery store and the thing
opens with the PC using a serial cnxn and the execution of a batch
file , can anyone help me in have the batch file executed from Excel
using a macro !!! ASAP please thnx

Tom Ogilvy

Macro to activate a Batch file !
 
sub RunBat()
shell "C:\myfolder\mybat.bat"
End Sub

--
Regards,
Tom Ogilvy


Tarek wrote in message
m...
i've just installed a cash drawer for my grocery store and the thing
opens with the PC using a serial cnxn and the execution of a batch
file , can anyone help me in have the batch file executed from Excel
using a macro !!! ASAP please thnx




Tarek Naghaway

Macro to activate a Batch file !
 
Dear Tom,
Thnx a lot, the code worked just fine , but as soon as i saved the excel
sheet and exited and reopened, it stopped working and then i noticed
that the batch file switched location to "c:\ my documents\read.bat"
instead of c:\windows\desktop\read.bat" why is this happening. I've also
tried hyperlinking to the batch file, but the same thing happened (I've
seen the properties of the batch file and the "Commandline" and
"Working" slots are empty, could that be the cause ??



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

Macro to activate a Batch file !
 
I can't say, but I would save the file in a specific directory (hopefully
the bat file doesn't contain code that moves it to another location). Then
the directory should not change I wouldn't think. You can look at the bat
file in notepad and see what code it contains.

--
Regards,
Tom Ogilvy

"Tarek Naghaway" wrote in message
...
Dear Tom,
Thnx a lot, the code worked just fine , but as soon as i saved the excel
sheet and exited and reopened, it stopped working and then i noticed
that the batch file switched location to "c:\ my documents\read.bat"
instead of c:\windows\desktop\read.bat" why is this happening. I've also
tried hyperlinking to the batch file, but the same thing happened (I've
seen the properties of the batch file and the "Commandline" and
"Working" slots are empty, could that be the cause ??



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 09:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com