+ Reply to Thread
Results 1 to 5 of 5

Macro to Close Excel Program at specific time of day

  1. #1
    Forum Contributor
    Join Date
    07-30-2014
    Location
    Mosman, Australia
    MS-Off Ver
    2013
    Posts
    118

    Macro to Close Excel Program at specific time of day

    Hi there,

    I need a macro that will close an excel file at a specific time of day (i.e. 7pm). I can't use the 'Task Scheduler' on my work PC, it has a restriction on it, therefore I need to insert a macro to have the file automatically close at 7pm at night.

    Can anyone provide me with this type of macro?

    Thanks

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Macro to Close Excel Program at specific time of day

    You may try something like this....

    Place the following code on ThisWorkbook Module...

    Please Login or Register  to view this content.
    Now on a Standard Module (Insert a new module), place the following code...
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor
    Join Date
    07-30-2014
    Location
    Mosman, Australia
    MS-Off Ver
    2013
    Posts
    118

    Re: Macro to Close Excel Program at specific time of day

    Hi sktneer,

    Thats great, it does work, however is there something that will close excel itself, the workbook closes but excel itself remains open.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Macro to Close Excel Program at specific time of day

    Replace the second sub-routine with the following one.....

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: Macro to Close Excel Program at specific time of day

    The workbook open event only fires when the workbook is opened and won't close at the specific time unless it is opened then. You might try a Wscript file running in the background that occasionally loops to check the time. The Wscript can then close the workbook at the appropriate time.

+ 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. Macro to close and re-open a workbook at specific time
    By hasanqz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2015, 03:38 PM
  2. How to program a macro to run at specific time
    By nantunes69 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-27-2013, 02:42 PM
  3. Auto close excel (2010) at specific time bypassing data validation
    By vstrom22 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-13-2012, 11:53 AM
  4. Close workbook at specific time
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2011, 03:45 PM
  5. Macro, or excel program to "Close All' while in a workspace
    By Carlton Patterson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2005, 07:07 AM
  6. [SOLVED] Macro, or excel program to "Close All' while in a workspace
    By Carlton Patterson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2005, 08:06 PM
  7. [SOLVED] Excel slow to close file/program
    By Ken in forum Excel General
    Replies: 2
    Last Post: 04-23-2005, 12:06 PM

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