+ Reply to Thread
Results 1 to 4 of 4

Autorun macro

  1. #1
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Autorun macro

    Hi all,

    I already have the macro to autorun another macro:

    Please Login or Register  to view this content.
    But my question is this, is there a way to perform this if the workbook is closed? Ideally, I would like the macro to run in the middle of the night (2:00 AM) because I have found that my macro frequently gets hung up by users having forms open (they forget to close out properly) *the macro I want to run grabs a bunch of Word forms and populates the excel spreadsheet with the form fields*. I am hoping that if I can autorun the macro at night, I won't have this issue, but what I have read makes it sound as though the workbook has to be open for the code to work??

    Thanks

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Autorun macro

    Hello Greed,

    That is correct. The workbook must be open for any macros to run. You could use your Task scheduler to automatically load the workbook so it will run at the specified time. You will need to write another macro to close the workbook automatically, if needed.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Autorun macro

    Forgive my ignorance...what is a Task scheduler?

    Also, I just completed a 'test'...I set the macro to a time (10 minutes ago) - left the workbook open (I did save, close and re-open the workbook) adn then went about my business, but nothing happened. I currently have the macro in the 'sheet' portion of VBA. Is that where it belongs?
    Thanks

  4. #4
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Autorun macro

    Well, I found the Task scheduler and set it up for last night...nothing happened.
    Also, the code isn't working at all when I attempt to test it and I'm not sure why or what to do to fix it. Any ideas?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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