Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to automatically close file
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to automatically close file
Kevin,
In a regular module, try the following: Sub Auto_Open() ' Following line will call "CloseMe" in 1 minute Application.OnTime Now + TimeValue("00:01:00"), "CloseMe" End Sub Sub CloseMe() ' If you want to save it before closing ThisWorkbook.Save ' To quit Excel altogether Application.Quit ' To just close the workbook and leave Excel open ThisWorkbook.Close End Sub John Kevin wrote: Does VBA code exist to automatically close a file after a specified period of time? Thanks. Kevin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to automatically close file
Thanks John.
I did get this code to work with it configured for "Application.Quit". However, gefore the file is closed a message box prompts "Do you want to save the changes you made to ...?" How can I get the file to auto close/quit without issuing this message? Thanks. Kevin -----Original Message----- Kevin, In a regular module, try the following: Sub Auto_Open() ' Following line will call "CloseMe" in 1 minute Application.OnTime Now + TimeValue("00:01:00"), "CloseMe" End Sub Sub CloseMe() ' If you want to save it before closing ThisWorkbook.Save ' To quit Excel altogether Application.Quit ' To just close the workbook and leave Excel open ThisWorkbook.Close End Sub John Kevin wrote: Does VBA code exist to automatically close a file after a specified period of time? Thanks. Kevin . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to automatically close file
Kevin,
Two ways......... Just before that code to quit Application.DisplayAlerts = False or...... fool the workbook into thinking it's already saved ThisWorkbook.Saved = True (just before the Quit coding) John Kevin wrote: Thanks John. I did get this code to work with it configured for "Application.Quit". However, gefore the file is closed a message box prompts "Do you want to save the changes you made to ...?" How can I get the file to auto close/quit without issuing this message? Thanks. Kevin -----Original Message----- Kevin, In a regular module, try the following: Sub Auto_Open() ' Following line will call "CloseMe" in 1 minute Application.OnTime Now + TimeValue("00:01:00"), "CloseMe" End Sub Sub CloseMe() ' If you want to save it before closing ThisWorkbook.Save ' To quit Excel altogether Application.Quit ' To just close the workbook and leave Excel open ThisWorkbook.Close End Sub John Kevin wrote: Does VBA code exist to automatically close a file after a specified period of time? Thanks. Kevin . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to automatically close file
Thanks much John.
You have been a great help. Kevin -----Original Message----- Kevin, Two ways......... Just before that code to quit Application.DisplayAlerts = False or...... fool the workbook into thinking it's already saved ThisWorkbook.Saved = True (just before the Quit coding) John Kevin wrote: Thanks John. I did get this code to work with it configured for "Application.Quit". However, gefore the file is closed a message box prompts "Do you want to save the changes you made to ...?" How can I get the file to auto close/quit without issuing this message? Thanks. Kevin -----Original Message----- Kevin, In a regular module, try the following: Sub Auto_Open() ' Following line will call "CloseMe" in 1 minute Application.OnTime Now + TimeValue ("00:01:00"), "CloseMe" End Sub Sub CloseMe() ' If you want to save it before closing ThisWorkbook.Save ' To quit Excel altogether Application.Quit ' To just close the workbook and leave Excel open ThisWorkbook.Close End Sub John Kevin wrote: Does VBA code exist to automatically close a file after a specified period of time? Thanks. Kevin . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
File/Close automatically saving changes without prompt | Excel Discussion (Misc queries) | |||
Copy from another file and close automatically | Excel Discussion (Misc queries) | |||
How to code the Macro to save and close a file? | Excel Discussion (Misc queries) | |||
close form code | Excel Discussion (Misc queries) | |||
Close worksheet with Macro or Code | Excel Programming |