![]() |
An executable file to run a VB script?
Is it possible to construct an executable file that will run from Windows XP
that will launch a VB script in Excel? I would like to be able to assign this .exe program to Windows Task Scheduler in order to send data to other programs at regular intervals. |
An executable file to run a VB script?
Why not just create a VBScript (.vbs, not VBA in Excel) that creates an
Excel instance and does some stuff, or a workbook with a workbook open event that does the stuff and is started regularly via scheduler. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Zakynthos" wrote in message ... Is it possible to construct an executable file that will run from Windows XP that will launch a VB script in Excel? I would like to be able to assign this .exe program to Windows Task Scheduler in order to send data to other programs at regular intervals. |
An executable file to run a VB script?
Tony,
Have you tried excel.exe "C:\Test\myBook.xls" ??? You might have to supply the full path for excel.exe to use the command line for task scheduler but I think the above will work. Personally, I think I'd put the VBA in an empty workbook that I'd save as an Excel template and have the data changes made in workbooks held in known locations. Steve "Zakynthos" wrote in message ... Steve, My intention is to create an .exe file that I can assign to to the Windows Task Scheduler but I think I'll have to give up on it as network security will probably log me off after 10 minutes or so - the script I've written is below. However, if I could access the scripting runtimes from within VBA as you say, how would I create an .exe file to assign this script to run through Task Scheduler? Many thanks, Tony |
An executable file to run a VB script?
Steve,
Great idea - thank you for the advice - sounds so simple I'll give it a try!!! But how do I initiate the macro within it? Would 'Test' in the path given below be the macro name within the 'blank' workbook 'myBook.xls' containing the script) I included in my previous reply? And would this workbook ideally be copied to the same location as the real-time daabase .exe file on which it operates? If so I'll give it a try on my laptop at home and, although the data export part won't run, for obvious reasons, I can at least check whether it will run under task scheduler. Best wishes, Tony "Steve Yandl" wrote: Tony, Have you tried excel.exe "C:\Test\myBook.xls" ??? You might have to supply the full path for excel.exe to use the command line for task scheduler but I think the above will work. Personally, I think I'd put the VBA in an empty workbook that I'd save as an Excel template and have the data changes made in workbooks held in known locations. Steve "Zakynthos" wrote in message ... Steve, My intention is to create an .exe file that I can assign to to the Windows Task Scheduler but I think I'll have to give up on it as network security will probably log me off after 10 minutes or so - the script I've written is below. However, if I could access the scripting runtimes from within VBA as you say, how would I create an .exe file to assign this script to run through Task Scheduler? Many thanks, Tony |
An executable file to run a VB script?
Tony,
You could create an auto_open subroutine that would get the sequence started from your workbook. Since this is an Excel programming group, I suggested the possibility of running scripts from within VBA. However, after looking a bit more at the VBA you shared, I think I'd do everything from a single vbs file and just translate what you currently have in VBA to vbScript. It may be a bit time consuming if macros in the other workbooks being worked on are extensive but you avoid a host of security roadblocks and will probably have a much faster process. A script can easily open multiple workbooks, move data between them and generally duplicate the actions of any functions or subroutines in those workbooks. Steve "Zakynthos" wrote in message ... Steve, Great idea - thank you for the advice - sounds so simple I'll give it a try!!! But how do I initiate the macro within it? Would 'Test' in the path given below be the macro name within the 'blank' workbook 'myBook.xls' containing the script) I included in my previous reply? And would this workbook ideally be copied to the same location as the real-time daabase .exe file on which it operates? If so I'll give it a try on my laptop at home and, although the data export part won't run, for obvious reasons, I can at least check whether it will run under task scheduler. Best wishes, Tony "Steve Yandl" wrote: Tony, Have you tried excel.exe "C:\Test\myBook.xls" ??? You might have to supply the full path for excel.exe to use the command line for task scheduler but I think the above will work. Personally, I think I'd put the VBA in an empty workbook that I'd save as an Excel template and have the data changes made in workbooks held in known locations. Steve "Zakynthos" wrote in message ... Steve, My intention is to create an .exe file that I can assign to to the Windows Task Scheduler but I think I'll have to give up on it as network security will probably log me off after 10 minutes or so - the script I've written is below. However, if I could access the scripting runtimes from within VBA as you say, how would I create an .exe file to assign this script to run through Task Scheduler? Many thanks, Tony |
An executable file to run a VB script?
Steve,
Thanks again. Not sure I have the skills to do this - but I'll research the methods and give it a try - can you suggest any links to help me create a vbs file for the script I want to run? - also would I need to 'auto-enable' macros in this script or would it circumvent this Excel dialogue box? "Steve Yandl" wrote: Tony, You could create an auto_open subroutine that would get the sequence started from your workbook. Since this is an Excel programming group, I suggested the possibility of running scripts from within VBA. However, after looking a bit more at the VBA you shared, I think I'd do everything from a single vbs file and just translate what you currently have in VBA to vbScript. It may be a bit time consuming if macros in the other workbooks being worked on are extensive but you avoid a host of security roadblocks and will probably have a much faster process. A script can easily open multiple workbooks, move data between them and generally duplicate the actions of any functions or subroutines in those workbooks. Steve "Zakynthos" wrote in message ... Steve, Great idea - thank you for the advice - sounds so simple I'll give it a try!!! But how do I initiate the macro within it? Would 'Test' in the path given below be the macro name within the 'blank' workbook 'myBook.xls' containing the script) I included in my previous reply? And would this workbook ideally be copied to the same location as the real-time daabase .exe file on which it operates? If so I'll give it a try on my laptop at home and, although the data export part won't run, for obvious reasons, I can at least check whether it will run under task scheduler. Best wishes, Tony "Steve Yandl" wrote: Tony, Have you tried excel.exe "C:\Test\myBook.xls" ??? You might have to supply the full path for excel.exe to use the command line for task scheduler but I think the above will work. Personally, I think I'd put the VBA in an empty workbook that I'd save as an Excel template and have the data changes made in workbooks held in known locations. Steve "Zakynthos" wrote in message ... Steve, My intention is to create an .exe file that I can assign to to the Windows Task Scheduler but I think I'll have to give up on it as network security will probably log me off after 10 minutes or so - the script I've written is below. However, if I could access the scripting runtimes from within VBA as you say, how would I create an .exe file to assign this script to run through Task Scheduler? Many thanks, Tony |
An executable file to run a VB script?
You can't auto-enable macros from a script or from a separate VBA routine.
That's one of the main advantages of translating all the VBA to a script. The script (if vbs files are permitted to run) will cause the same actions but won't trigger multiple macro warnings. Steve "Zakynthos" wrote in message ... Steve, Thanks again. Not sure I have the skills to do this - but I'll research the methods and give it a try - can you suggest any links to help me create a vbs file for the script I want to run? - also would I need to 'auto-enable' macros in this script or would it circumvent this Excel dialogue box? "Steve Yandl" wrote: Tony, You could create an auto_open subroutine that would get the sequence started from your workbook. Since this is an Excel programming group, I suggested the possibility of running scripts from within VBA. However, after looking a bit more at the VBA you shared, I think I'd do everything from a single vbs file and just translate what you currently have in VBA to vbScript. It may be a bit time consuming if macros in the other workbooks being worked on are extensive but you avoid a host of security roadblocks and will probably have a much faster process. A script can easily open multiple workbooks, move data between them and generally duplicate the actions of any functions or subroutines in those workbooks. Steve "Zakynthos" wrote in message ... Steve, Great idea - thank you for the advice - sounds so simple I'll give it a try!!! But how do I initiate the macro within it? Would 'Test' in the path given below be the macro name within the 'blank' workbook 'myBook.xls' containing the script) I included in my previous reply? And would this workbook ideally be copied to the same location as the real-time daabase .exe file on which it operates? If so I'll give it a try on my laptop at home and, although the data export part won't run, for obvious reasons, I can at least check whether it will run under task scheduler. Best wishes, Tony "Steve Yandl" wrote: Tony, Have you tried excel.exe "C:\Test\myBook.xls" ??? You might have to supply the full path for excel.exe to use the command line for task scheduler but I think the above will work. Personally, I think I'd put the VBA in an empty workbook that I'd save as an Excel template and have the data changes made in workbooks held in known locations. Steve "Zakynthos" wrote in message ... Steve, My intention is to create an .exe file that I can assign to to the Windows Task Scheduler but I think I'll have to give up on it as network security will probably log me off after 10 minutes or so - the script I've written is below. However, if I could access the scripting runtimes from within VBA as you say, how would I create an .exe file to assign this script to run through Task Scheduler? Many thanks, Tony |
All times are GMT +1. The time now is 12:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com