Schedule Tasks through VBA

bromy2004

Board Regular
Joined
Feb 8, 2008
Messages
63
Hi Guys & Gals,

i'm trying to use Excel VBA to create schedule tasks.
I'm using a very simple macro to test it
Code:
Sub Test()

Shell (Selection.Value)

End Sub

The selection at the time is the commands for CMD SCHTASKS in one complete string
Code:
SCHTASKS /S \\RemoteCompName /U MYDOMAIN\MYUSERNAME /P MYPASSWORD /RU MYDOMAIN\RemoteCompUser /RP RemoteCompPassword /SC WEEKLY /D MON,TUE,WED,THU,FRI /M JAN, FEB, MAR,APR, MAY, JUN, JUL, AUG, SEP, OCT,NOV, DEC /TN Back Order (Sales) - 100 

/TR "C:\Program Files\JetReports\autopilot.exe" /m "Update" /I \\QCSVR01\QuickCorporate$\Quick Corporate\Forms\Backup_Forms\Jet - Sales and Marketing\Back Order (Sales).xls /O "\\QCSVR01\QuickCorporate$\Quick Corporate\Forms\Jet - Sales And Marketing\Back Order\Rep 100\%YEAR%\%MONTH%\Back Order - 100 %DAY%-%MONTH%-%YEAR%.xls /L \\QCSVR01\QuickCorporate$\Quick Corporate\Forms\Daily Schedule Log.txt /e aaa@mail.com;bbb@mail.com /P "Acct_Mngr" "100" 

/ST 21:02:00 /SD "01/01/2009"

the screen flickers (it actually works)
but nothing is created.
ive typed it in manually i get an error
Code:
ERROR: Length of the command line argument should not exceed 255 characters.

the is currently an addin that does all this already. but i want to do it in Bulk (50-70 tasks)

can anyone please help me???
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

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