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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

BJungheim

Well-known Member
Joined
Jul 24, 2004
Messages
914
You should be able to simply add this line:
Code:
Shell ("c:\Enter\file\path\here\test01.bat")
 

Forum statistics

Threads
1,136,596
Messages
5,676,712
Members
419,646
Latest member
ReneeDJ73

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
Top