run macro from closed workbook automatically for every 24 hours

  • Hi all,


    I have a file which is having name as "Team data-11/23/2012"
    actually i have to create a file on daily basis except Saturday and Sunday.
    I need a macro which automatically runs from one file and saves the excel file on daily basis. and the file name should "team data - (today's date)". this file also should be created automatically. it means that macro should run automatically for every 24 hours.


    any help highly appreciated...



    Thanks & Regards,
    PRB.

  • Re: run macro from closed workbook automatically for every 24 hours


    Perhaps you schedule a task in Windows to run Excel using a switch to open the specific file, have the code set to run on workbook open, then close/save after macro execution.
    Do a little searching on how to use the scheduler in Windows.

  • Re: run macro from closed workbook automatically for every 24 hours


    Thanks for immediate reply..


    I have researched, and tried about scheduler in windows.
    now i need a code which can create a new excel file with today's date.


    after opening that file with scheduler that macro will run automatically or not?
    all these work should done from back end only.


    Regards,
    PRB.

  • Re: run macro from closed workbook automatically for every 24 hours


    If you shut down your PC Scheduler will not work.


    Once you open the file, scheduled or not the macro will automatically run.


    ActiveWorkbook.SaveAs "Team Data" & Format(Now, "dd-mm-yyyy") & ".xls" will save it as requested.

  • Re: run macro from closed workbook automatically for every 24 hours



    Ensure that cell A1 has a zero in it. This will enable the macro to run automatically when the workbook is opened. The zero changes to a one when it is saved, so when someone opens the saved file the macro doesn't run.


    Change the following to the path of where you want it saved.


    ChDir _
    "C:\Documents and Settings\USER NAME\desktop"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!