exec a *.bat file from a macro

frotaru

Board Regular
Joined
Oct 12, 2006
Messages
124
Is it possible to run a *bat file from a macro ?? if yes how??

For example the bat file name is test01.bat

How can I run this bat file from this sub


Sub mysub01()

Dim FieldOrderChk As String
FieldOrderChk = "=IF(ISERROR(VLOOKUP(R[-1]C,[Fields.xls]PDiff_Fields!R5C1:R50C2,2,FALSE)),"""",VLOOKUP(R[-1]C,[Fields.xls]PDiff_Fields!R5C1:R50C2,2,FALSE))"

If Range("A2").FormulaR1C1 = FieldOrderChk Then
ActiveWorkbook.Save
ActiveWindow.Close
Else
Application.Run "SuppInf.xls!DPDF_Field_Order"
Application.Run "SuppInf.xls!DPDF_Cntrz_End_Chk_Formula1"
End If
ActiveWorkbook.Save
ActiveWindow.Close


!!! Here run / exec test01.bat


End Sub


Thank you
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
You should be able to simply add this line:
Code:
Shell ("c:\Enter\file\path\here\test01.bat")
 
Upvote 0

Forum statistics

Threads
1,215,024
Messages
6,122,729
Members
449,093
Latest member
Mnur

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