Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Schedule an xl file
Greetings.......
How can i schedule to run an xls file on specific time if it has macros to enable. Thanks in Advance Zubair |
#2
|
|||
|
|||
Hi Zubair,
How can i schedule to run an xls file on specific time if it has macros to enable. Create a scheduled task in Windows to run a batchfile, the batchfile can start Excel and your xls-file, the xls-file needs an auto_open macro (or the workbook event for the same purpose) to start the procedure. arno |
#3
|
|||
|
|||
Thanks for quick response......
Could you please elaborate more , I dont have a real coding but it is an SQL.REQUEST that fetches record from a database. Thanks Zubair "arno" wrote: Hi Zubair, How can i schedule to run an xls file on specific time if it has macros to enable. Create a scheduled task in Windows to run a batchfile, the batchfile can start Excel and your xls-file, the xls-file needs an auto_open macro (or the workbook event for the same purpose) to start the procedure. arno |
#4
|
|||
|
|||
Hi Zubair,
an SQL.REQUEST that fetches record from a database. if this is working, fine. if it is not, then pls. try starting a new thread to solve the problem. So, if your sql. is working then create a macro called auto_open. It should look like this sub auto_open() application.run("yourmacrofetchingthedata") ' start your sql-request thisworkbook.saved = true 'do not ask when closing the book w/o saving application.quit 'close excel end sub When you open the workbook (let's call it yourfile.xls) the macro will run and close excel. Now you need a batchfile "mybatch.bat" to run that file with the following line: "c:\...path...\excel.exe" "c:\...whateverpath...\yourfile.xls" Doubleclicking on mybatch.bat will start excel, open yourfile.xls, execute your macro and close excel. Then you need a scheduled task from windows, in you explorer click on start/settings/controlpanel/scheduledtasks and create a new one. In the "task" window you can specify mybatch.bat to run, which username should be used etc., in the next window you can set the time/days when it should run. Pls. note, that your PC has to be turned on if you want the macro to run overnight. If you run it on a server make sure you have sufficient privileges to do so or you need an (admin) username and password. Have a try, arno |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) | |||
Locating a file in excel with a partial file name. | Excel Discussion (Misc queries) | |||
Read Text File into Excel Using VBA | Excel Discussion (Misc queries) | |||
Convert text file to MS_Excel | Excel Discussion (Misc queries) |