I have written a macro and a function in vba that I want to use in conjucntion with Macro Scheduler.
I am having difficulty converting it to vb script .
Is it possible to run excel vba macros and functions from Macro Scheduler ?
If so how could I return a value running a vba function ?
Can I run them without opening the excel file ?
Run vba a macro or function ?
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You can either:
1) Call an Excel macro:
http://www.mjtnet.com/forum/viewtopic.php?t=3825
2) Convert the Excel VBA to VBScript. All references to Excel objects will have to be created using CreateObject. (Code in Excel knows about Excel. Code outside of Excel doesn't until you tell it). Search here for CreateObject("Excel.Application"). Also some samples with the software and here: http://www.mjtnet.com/blog/2007/07/02/m ... xcel-data/
1) Call an Excel macro:
http://www.mjtnet.com/forum/viewtopic.php?t=3825
2) Convert the Excel VBA to VBScript. All references to Excel objects will have to be created using CreateObject. (Code in Excel knows about Excel. Code outside of Excel doesn't until you tell it). Search here for CreateObject("Excel.Application"). Also some samples with the software and here: http://www.mjtnet.com/blog/2007/07/02/m ... xcel-data/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
Thanks for your reply.
Hopefully the first option will provide the solution .
I tinkered around with converting my vba code to vb script .
I ran my vba code in the editor between the vb tags commenting out the code and adding a few lines at a time to see what ended up generating errors.
The task of converting to vb script seems to require a substantail learning curve. An example being goto doesn't exist in vb script and I would need to rewrite all my loops .
How can I go about passing argument to the macro or function and passing values back to my script when I run my vba macro or function according to your example ?
Hopefully the first option will provide the solution .
I tinkered around with converting my vba code to vb script .
I ran my vba code in the editor between the vb tags commenting out the code and adding a few lines at a time to see what ended up generating errors.
The task of converting to vb script seems to require a substantail learning curve. An example being goto doesn't exist in vb script and I would need to rewrite all my loops .
How can I go about passing argument to the macro or function and passing values back to my script when I run my vba macro or function according to your example ?