+ Reply to Thread
Results 1 to 4 of 4

Schedule an xl file

  1. #1
    Zubair
    Guest

    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. #2
    arno
    Guest

    Re: Schedule an xl file

    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. #3
    Zubair
    Guest

    Re: Schedule an xl file

    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. #4
    arno
    Guest

    Re: Schedule an xl file

    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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1