+ Reply to Thread
Results 1 to 5 of 5

Execute a macro in a closed workbook, or open and execute without the user noticing

  1. #1
    Registered User
    Join Date
    12-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Execute a macro in a closed workbook, or open and execute without the user noticing

    Dear All.

    I'd like to know if there is a way to execute a macro on a set schedule (i.e. at 10:00 AM every workday) on a closed workbook, or have the workbook to open automatically on a set schedule, execute the macro and close.

    Please let me know if you need to clarify further.

    Thank you!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    37,356

    Re: Execute a macro in a closed workbook, or open and execute without the user noticing

    You could use the Windows Scheduler to launch a Macro Enabled Workbook with a Workbook Open event handler.

    The event handler could, in turn, launch your macro which would, as a last action, (save and) close the workbook.


    Regards, TMS

  3. #3
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    963

    Re: Execute a macro in a closed workbook, or open and execute without the user noticing

    Exactly -

    I do this with task scheduler as TMS described, would run it at 9:59 and then inside "This Workbook" put this

    Please Login or Register  to view this content.
    MacroName would call on the macro in your module that would run the macro you desire. Now this will NOT go unnoticed by the user - they will see an instance of excel open up. At most you can disable screen updating in the application which would allow the macro to run quickly but not flip back and forth between tasks, but the user will know there is a file open and will cause errors should they start clicking all over the place attempting to take control... Best to do on a remote PC or when you know no one will be on. And of course you can do Workbook close or Application Quit depending on if you want excel to remain open or to shut down completely...

    Cheers
    -If you think you are done, Start over - ELeGault

  4. #4
    Registered User
    Join Date
    12-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Execute a macro in a closed workbook, or open and execute without the user noticing

    Thank you very much for your reply!!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    37,356

    Re: Execute a macro in a closed workbook, or open and execute without the user noticing

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Open workbook works on stepping but not on execute
    By Wongadob in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-09-2015, 01:33 PM
  2. Vba to open excel in timely schedule and execute macro inside the workbook
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-23-2013, 10:48 PM
  3. How to execute a macro when user selects radiobutton
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-07-2013, 09:49 AM
  4. Execute macro logged in as another user
    By sirrahhc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2012, 10:23 AM
  5. [SOLVED] Automatically execute a CTRL-ALT-F9 when I open a workbook
    By Antonio Duarte in forum Excel General
    Replies: 1
    Last Post: 06-15-2005, 10:05 AM

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