Executing DOS commands using VBA

thinksriniii

Board Regular
Joined
Apr 1, 2009
Messages
93
Hi Guys,

Could you please help me on how to execute these DOS commands using a Macro.
ü Go to command prompt and execute ‘CD D:\BATCH’<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
ü Execute ‘SETENVD UK BB’ (UK – country code ; BB – Report type)<o:p></o:p>
ü Execute ‘DEDT’<o:p></o:p>
ü Execute ‘DEO’<o:p></o:p>
ü Execute ‘CODE’<o:p></o:p>
ü Execute ‘STAT’<o:p></o:p>
ü Execute ‘KEY’<o:p></o:p>
ü Execute ‘USERHELP’<o:p></o:p>
ü Execute ‘XVAL’<o:p></o:p>
ü Execute ‘COMPALL UK BB’<o:p></o:p>
ü Execute ‘VIEWD UK BB’



And the Macro should automatically run everyday at 9AM.

Cheers,
Costa Dave

<o:p></o:p>
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi Guys,

Could you please help me on how to execute these DOS commands using a Macro.

And the Macro should automatically run everyday at 9AM.

Cheers,
Costa Dave

<o:p></o:p>

Basically you needs batch programming because VBA only runs when we run Excel ......

Or you can use Schedule Task in Control Panel ..... which we can do various things ....
 
Upvote 0
Then, Probably i would remove the last part of my question. Its enough now to incorporate it in VBA.

Cheers,
Dave
 
Upvote 0
Can't you simply put those commands into a batch file and call that from VBA?
 
Upvote 0
Hi Rory,

Many thanks for your reply. But, am a newbie to VBA. Could you please explain how to do it.

Cheers,
Dave Costa
 
Upvote 0

Forum statistics

Threads
1,215,654
Messages
6,126,048
Members
449,282
Latest member
Glatortue

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