ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close Workbook Programmatically (https://www.excelbanter.com/excel-programming/286390-close-workbook-programmatically.html)

Lucy[_2_]

Close Workbook Programmatically
 
I need to shut down open Excel workbooks at specific time
(e.g. 1 AM) to start data upload. This code will be
included with every workbook that must be closed before
the upload starts (the workbooks reside on a network
drive, but may stay open on different PC's due to users
no closing them, etc.).

Does anybody know the code or point me to a resource to
the trigger this update at the selected time?

Thanks for your help.

Lucy


Rob van Gelder[_4_]

Close Workbook Programmatically
 
I don't know of an easy way to do this.
The complicated way would probably involve checking the file system for who
has open locks, then killing their open locks. It could get messy.

You could maintain copies, ie. users work on a user file, uploads work on
the upload files.


"Lucy" wrote in message
...
I need to shut down open Excel workbooks at specific time
(e.g. 1 AM) to start data upload. This code will be
included with every workbook that must be closed before
the upload starts (the workbooks reside on a network
drive, but may stay open on different PC's due to users
no closing them, etc.).

Does anybody know the code or point me to a resource to
the trigger this update at the selected time?

Thanks for your help.

Lucy




Lucy[_2_]

Close Workbook Programmatically
 
I think it is not really that difficult. All I need is a
trigger to start running the following sub (that will be
included in the workbook) at the selected time.

Sub Quit_Workbook()
With Application
.DisplayAlerts = False
.ThisWorkbook.Close False
.Quit
End With
End Sub

It's the trigger I am looking for that will shut down the
app at 1 AM without any user intervention (in MS Access I
can accomplish that with On Timer event).

I have the following code, but again I need another code
(trigger) to start this without anybody's intervention:

If Format(Now(), "Medium Time") = Format
("01:00:00, "Medium Time") Then
Application.OnTime Now + TimeValue
("00:0:05"), "Quit_Workbook"
End If

Do you know how the trigger this?

Thanks.

Lucy

-----Original Message-----
I don't know of an easy way to do this.
The complicated way would probably involve checking the

file system for who has open locks, then killing their
open locks. It could get messy.

You could maintain copies, ie. users work on a user

file, uploads work on the upload files.


"Lucy" wrote in

message
...
I need to shut down open Excel workbooks at specific

time
(e.g. 1 AM) to start data upload. This code will be
included with every workbook that must be closed before
the upload starts (the workbooks reside on a network
drive, but may stay open on different PC's due to users
no closing them, etc.).

Does anybody know the code or point me to a resource to
the trigger this update at the selected time?

Thanks for your help.

Lucy



.


Rob van Gelder[_4_]

Close Workbook Programmatically
 
You might have success with Application.OnTime TimeValue("17:00:00"),
"my_Procedure"

"Lucy" wrote in message
...
I think it is not really that difficult. All I need is a
trigger to start running the following sub (that will be
included in the workbook) at the selected time.

Sub Quit_Workbook()
With Application
.DisplayAlerts = False
.ThisWorkbook.Close False
.Quit
End With
End Sub

It's the trigger I am looking for that will shut down the
app at 1 AM without any user intervention (in MS Access I
can accomplish that with On Timer event).

I have the following code, but again I need another code
(trigger) to start this without anybody's intervention:

If Format(Now(), "Medium Time") = Format
("01:00:00, "Medium Time") Then
Application.OnTime Now + TimeValue
("00:0:05"), "Quit_Workbook"
End If

Do you know how the trigger this?

Thanks.

Lucy

-----Original Message-----
I don't know of an easy way to do this.
The complicated way would probably involve checking the

file system for who has open locks, then killing their
open locks. It could get messy.

You could maintain copies, ie. users work on a user

file, uploads work on the upload files.


"Lucy" wrote in

message
...
I need to shut down open Excel workbooks at specific

time
(e.g. 1 AM) to start data upload. This code will be
included with every workbook that must be closed before
the upload starts (the workbooks reside on a network
drive, but may stay open on different PC's due to users
no closing them, etc.).

Does anybody know the code or point me to a resource to
the trigger this update at the selected time?

Thanks for your help.

Lucy



.





All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com