+ Reply to Thread
Results 1 to 6 of 6

Macro to run automatically

  1. #1
    Registered User
    Join Date
    07-28-2009
    Location
    Chicago, Il
    MS-Off Ver
    Excel 2007
    Posts
    67

    Macro to run automatically

    I have a macro that runs everynight at 11:55pm and saves but it only works if i have the file open at work. the problem being that i do not work everynight so wanted to see if there was a way to have the macro run without having the file open and it open itself and do the process

    Is this possible or is there another way to set this up?

    Thanks

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Macro to run automatically

    Hi,

    will your computer be switched on? You could use the Windows scheduled task to run Excel and open a specific file.

    Start - All Programs - Accessories - System tools - Scheduled tasks

    go through the wizard, select Excel as the application to start, select the time and in the final page, where you can edit the application to be opened, replace the excel application with the link to the Excel file.

    would that work?

  3. #3
    Registered User
    Join Date
    07-28-2009
    Location
    Chicago, Il
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro to run automatically

    That would work and am working to have the rights to this but this is a work computer and we have limited access and this is one of the one things i do not have access to at this time

    Any other way of doing this?

    Thanks

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to run automatically

    Hi Ricardo9211
    I've several workbooks that I save on a timer. It's been my experience that if I don't have a "Stop Timer" command in a Workbook Close Event, the timer will re-open the Workbook and run the procedure AS LONG AS I'VE NOT CLOSED THAT SESSION OF EXCEL.. So, if you are stopping the timer when you close the workbook, comment out that line, leave the current Excel session open and see if your procedure doesn't run on schedule. Mine does. If you don't have a "Stop Timer" command in Workbook Close Event, I believe you can close the workbook, leave the Excel session open and your procedure will reopen the file and run. Try this and see if it works the same for you. You MUST leave the Excel session open.
    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Registered User
    Join Date
    07-28-2009
    Location
    Chicago, Il
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro to run automatically

    I will try that tonight. yes i do leave my computer on and at this point i have not tried this. now when you say leave the Excel session open you do mean just have excel open with no workbook open correct?


    Thanks for all your help by the way

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to run automatically

    That's correct. Close the workbook but don't close Excel. This has worked for me in the past (except I didn't want it to work; you do). That's why I put the "Stop Timer" code in the workbook close event. Let me know how you make out.
    John

+ 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