Greetings All
I'm not new to VBA - But I am very new to VBScript - So please forgive if I'm not asking for help the right way
SetUp:
I'm simply trying to automate a run reports task through MS Task Scheduler
I've created both .vbs and .bat files - in fact I've created several.
Here are a .bat & .vbs that work -
So those work as do a couple others moving between local and shared folders
These, however, I can't get to work for the life of me.
I tried moving everything to the Desktop and tried a little bit different code - Still nothing
I'm venturing down a dark road so any light you can shine on this would be greatly appreciated
Thank You...
Rt91
I'm not new to VBA - But I am very new to VBScript - So please forgive if I'm not asking for help the right way
SetUp:
I'm simply trying to automate a run reports task through MS Task Scheduler
I've created both .vbs and .bat files - in fact I've created several.
Here are a .bat & .vbs that work -
Code:
Run.bat
CScript Script2.Vbs "C:\Users\FS115436\Documents\Test"
Script2.vbs
StrPath = "C:\Users\FS115436\Documents\Test\Excel VBS TestBook1.xlsm"
Set xlApp=CreateObject("Excel.Application")
Set xlWb=xlApp.WorkBooks.Open(StrPath)
xlApp.Workbooks.Open(StrPath)
xlApp.Visible = True
xlApp.Run "VBSTest1"
Set xlWb = Nothing
Set xlApp = Nothing
So those work as do a couple others moving between local and shared folders
These, however, I can't get to work for the life of me.
Code:
Run.bat
CScript Script3.vbs "N:\Sales Management \Internal\Confidential\BusSysAnalyst\WIP"
Script3.vbs
StrPath = "N:\Sales Management \Internal\Confidential\BusSysAnalyst\WIP\Excel Master IW Reports BusSys.xlsm"
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.WorkBooks.Open(StrPath)
xlApp.Workbooks.Open(StrPath)
xlApp.Visible = True
xlApp.Run "AdHocRprts"
Set xlWb = Nothing
Set xlApp = Nothing
I tried moving everything to the Desktop and tried a little bit different code - Still nothing
Code:
Run.bat
CScript Script.vbs "C:\Users\FS115436\Desktop"
Script.vbs
Dim args, objExcel
Dim Path As String
Set Path = "C:\Users\FS115436\Desktop\Excel Master IW Reports BusSys.xlsm"
Set args = wScript.Arguments
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open(Path)
objExcel.Visible = True
objExcel.Run "AdhocRprts"
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit
I'm venturing down a dark road so any light you can shine on this would be greatly appreciated
Thank You...
Rt91