Results 1 to 6 of 6

Thread: Timer to close excel workbook

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    19
    Rep Power
    0

    Timer to close excel workbook

    Hi,
    I was trying to make a code to close the workbook after a time period (in this code it is set to 30 sec)
    It should give a warning message, before 10 sec of its closing event.
    the code I have is as below.

    But I am little confused that where the code to be pasted.. (in Workbook or in the module)

    Please help..it is not working



    Code:
    Sub close_me()
    ThisWorkbook.Close Savechanges:=True
    End Sub
    
    
    Sub close1_me()
    MsgBox "Please update the file. The file will close with in 10 sec."
    Application.OnTime Now + TimeValue("00:00:10"), "close_Me"
    End Sub
    
     
    Private Sub Workbook_Open()
    Application.OnTime Now + TimeValue("00:00:30"), "close1_Me"
    End Sub
    Last edited by leopaulc; 10-24-2011 at 09:43 AM.

Similar Threads

  1. Macro To Close All CSV Files
    By Howardc in forum Excel Help
    Replies: 5
    Last Post: 03-15-2014, 05:24 PM
  2. Combobox Not Working In Excel Workbook Shared Mode
    By peter renton in forum Excel Help
    Replies: 15
    Last Post: 06-03-2013, 01:25 PM
  3. Automate Date Changes Within Excel Workbook
    By Danno2cu in forum Excel Help
    Replies: 9
    Last Post: 02-18-2013, 11:39 PM
  4. Replies: 2
    Last Post: 12-04-2012, 02:05 PM
  5. Replies: 2
    Last Post: 12-12-2011, 01:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •