Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Zubair
 
Posts: n/a
Default 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   Report Post  
arno
 
Posts: n/a
Default

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   Report Post  
Zubair
 
Posts: n/a
Default

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   Report Post  
arno
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 3rd 05 03:40 PM
Locating a file in excel with a partial file name. Audra Excel Discussion (Misc queries) 0 February 19th 05 02:03 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
Convert text file to MS_Excel Aqua Flow Excel Discussion (Misc queries) 1 November 30th 04 02:55 AM


All times are GMT +1. The time now is 01:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"