Worked great, after a few tries. I managed to type the .xlsm file path wrong at first. By typing pause in a new line in the .bat file I was able to see my error after the file ran, and correct.
hello, Ive done exactly the same procedure but macro did not run. I mean run.bat is able to run script.vbs then this script is able to open excel, but it cant rund the macro. When i chceck the file I see the macro wasnt realized. Any idea? thank you
the sample doesn't work if you are running multiple modules. you have to specify which module and which sub. And if it takes time for macro to finish, make sure you put a pause in between to allow the macro to completely finish its run. I had used this instead in the vbscript. Dim objExcel, xlBook Set objExcel = CreateObject("Excel.Application") Set xlBook = objExcel.Workbooks.Open ("C:\OTS\tstjovtst_OTS.xlsm") objExcel.Visible = True objExcel.Run xlBook.name & "!Module3.Sevenam" /mine is in module3, macroname is sevenam/ WScript.Sleep 100000 objExcel.ActiveWorkbook.Save objExcel.ActiveWorkbook.Close(0) objExcel.Quit in the batch file simply used: cscript sevenam.vbs /filename of the vbs is "sevenam"/
When I run script, I got error: Line: 6 Char: 1 Error: Subscript out of range Code: 800A0009 Something wrong with line: objExcel.Workbooks.Open args(0)
Thx for this tut. It works for me and it looks very fancy to me, specially when I set objExcel.Visible = False and everything happens in background. As I recommendation, you can use the PAUSE word in batch file to see if there is an error or if everything worked just fine. What I do not understand is the argument object. What we use that for? Thank you.
L.E: I figured out. The args are related to the path and the name of module that we mention in batch file. We can also remove the args object, create 2 string, one containing the path of the workbook and the other one containing the name of the module and we would have: objExcel.Workbooks.Open wkbPath and objExcel.Run modulName. Thx again
Hi - When I run this script / batch file from task scheduler - I see the dos window flash but the micro doesn't run? anybody ideas why? If I run the batch file manually, works fine. thanks
I executed the macro by using only vbs but the GetOpenFileName pop-up called in macro is not coming on top of screen-which successfully comes when running the macro independent of the vbs---how to solve this issue?
Hey All - Here is the script.vbs code that can be copied and used. Dim args, objExcel Set objExcel = CreateObject("Excel.Application") Set args = wscript.Arguments objExcel.Workbooks.Open args(O) ' Capital letter "O" objExcel.visible = True objExcel.Run "helloworld" objExcel.ActiveWorkbook.Save ''wscript.sleep 5000 'sleep for 5sec 'this code can be used to pause and check the terminal window activity ObjExcel.Activeworkbook.Close(O) ' Capital letter "O" ObjExcel.Quit
When I tried to run the VB script I got a Windows Script Host Error, Source: Microsoft VBScript runtime error (Code: 800A0009). Did anyone get the same error? Help, please!
Actually do u know in an banking application we get birthday alerts using SMS or an Email in that way I want to send an automatic email from excel to group of people I will hardcore a date in one of column of excel that is 1st of every month then 15th Of every month then 30th of every month An email will shoot when the system reaches to the date specified in the excel column
Hi - When I run this script Run.bat file and from task scheduler - I see the dos window flash but the macro doesn't run? anybody ideas why? If I run the file manually, works fine. thanks
2 days looking for a working method for this, and this one worked perfect thanks very much!
I couldn't tell what happen after you ran the run.bat youtube place some next videos at the end all over the screen.
perfect thanks, i advise to make a pause on the batch to get the errors if any
what if, the macro method in private ? will the method triggered from vbs ? kindly share your suggestion
Worked great, after a few tries. I managed to type the .xlsm file path wrong at first. By typing pause in a new line in the .bat file I was able to see my error after the file ran, and correct.
Can you send/post the vbs script so that I can copy-paste? It's hard to tell if something is a zero or an O, or a comma or a period. Thank you!
hello, Ive done exactly the same procedure but macro did not run. I mean run.bat is able to run script.vbs then this script is able to open excel, but it cant rund the macro. When i chceck the file I see the macro wasnt realized. Any idea?
thank you
mine is not working either... any solutions yet ?
the sample doesn't work if you are running multiple modules. you have to specify which module and which sub. And if it takes time for macro to finish, make sure you put a pause in between to allow the macro to completely finish its run.
I had used this instead in the vbscript.
Dim objExcel, xlBook
Set objExcel = CreateObject("Excel.Application")
Set xlBook = objExcel.Workbooks.Open ("C:\OTS\tstjovtst_OTS.xlsm")
objExcel.Visible = True
objExcel.Run xlBook.name & "!Module3.Sevenam" /mine is in module3, macroname is sevenam/
WScript.Sleep 100000
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit
in the batch file simply used:
cscript sevenam.vbs /filename of the vbs is "sevenam"/
When I run script, I got error:
Line: 6
Char: 1
Error: Subscript out of range
Code: 800A0009
Something wrong with line: objExcel.Workbooks.Open args(0)
Dmitriy Preobrazhenskiy check for spell miss
running
cscript script.vbs "C:\Test\Book1.xlsm"
gives me
Microsoft VBScript runtime error: Wrong number of arguments or invalid property assignment
Thx for this tut. It works for me and it looks very fancy to me, specially when I set objExcel.Visible = False and everything happens in background. As I recommendation, you can use the PAUSE word in batch file to see if there is an error or if everything worked just fine. What I do not understand is the argument object. What we use that for? Thank you.
L.E: I figured out. The args are related to the path and the name of module that we mention in batch file. We can also remove the args object, create 2 string, one containing the path of the workbook and the other one containing the name of the module and we would have: objExcel.Workbooks.Open wkbPath and objExcel.Run modulName. Thx again
Hi - When I run this script / batch file from task scheduler - I see the dos window flash but the micro doesn't run? anybody ideas why? If I run the batch file manually, works fine. thanks
Nice work and great video !!
I executed the macro by using only vbs but the GetOpenFileName pop-up called in macro is not coming on top of screen-which successfully comes when running the macro independent of the vbs---how to solve this issue?
Thank You Very Much Sir, Its perfectly Working.....
how to apply same macro to other xlsm sheet not owner to macro
or how to make macro public for many xlsm ?
Works perfect, thanks!
There is no search box on your website. Why dont you add the code here?
hello sir i need a vb scropt to find a value from excsl
Works perfectly! How can one add multiple Excel files in the same script?
thanks a lot, i have already find find answer for vbs too :). perfect helping video! :)
Unable to see last execution
That was perfect! Thank you very much.
Hey All - Here is the script.vbs code that can be copied and used.
Dim args, objExcel
Set objExcel = CreateObject("Excel.Application")
Set args = wscript.Arguments
objExcel.Workbooks.Open args(O) ' Capital letter "O"
objExcel.visible = True
objExcel.Run "helloworld"
objExcel.ActiveWorkbook.Save
''wscript.sleep 5000 'sleep for 5sec 'this code can be used to pause and check the terminal window activity
ObjExcel.Activeworkbook.Close(O) ' Capital letter "O"
ObjExcel.Quit
You are the real game changer...Thanks Buddy ..
Would anyone know how to trigger the macro that is not part of the workbook but is being stored in Personal.xlsb folder?
Thanks Sir for this tutorial and also tell me know that how can exit .bat with the help of Script that Which is used to run script.vbs
For me the excel is getting is crashed and not getting the output, can you please help...
When I tried to run the VB script I got a Windows Script Host Error, Source: Microsoft VBScript runtime error (Code: 800A0009). Did anyone get the same error? Help, please!
I got that same error
i followed the same convention and process but still i am not getting the results
Actually do u know in an banking application we get birthday alerts using SMS or an Email in that way I want to send an automatic email from excel to group of people
I will hardcore a date in one of column of excel that is
1st of every month then
15th Of every month then
30th of every month
An email will shoot when the system reaches to the date specified in the excel column
Cool, thanks :]
Thank u!
Thanks!!
Thanks.
Good!
didn't work for me
Awesome, thanks!
Module is getting deleted automatically
Not working
android
Hi - When I run this script Run.bat file and from task scheduler - I see the dos window flash but the macro doesn't run? anybody ideas why? If I run the file manually, works fine. thanks
It's not working