ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto closing a work book (https://www.excelbanter.com/excel-programming/338296-auto-closing-work-book.html)

myssieh

auto closing a work book
 
is there a program that can be written that will close a workbook and make it
read only at a certain time and then reopen it at another specified time? I
am runing office and window xp professional.

thanks in advance for any help!!

Gareth[_6_]

auto closing a work book
 
To make a workbook readonly (or make a readonly workbook write) you
don't need to close it. Just use:

Sub MakeWorkbookReadonly()
'you may like to check whether the user should save their work
If not thisworkbook.readonly then _
thisworkbook.ChangeFileAccess Mode:=xlReadOnly
End sub

Sub MakeWorkbookWrite()
If thisworkbook.readonly then _
thisworkbook.ChangeFileAccess Mode:=xlReadwrite
End sub

To do this at a certain time is a little trickier. One way is to set
OnTime procedures, say at workbook open. I would play with various
methods and see which one works best for you.

Sub SetModeSwitching()

Application.OnTime TimeValue("15:00:00"), "MakeWorkbookReadonly"
Application.OnTime TimeValue("16:00:00"), "MakeWorkbookWrite"

End Sub


HTH,
Gareth

myssieh wrote:
is there a program that can be written that will close a workbook and make it
read only at a certain time and then reopen it at another specified time? I
am runing office and window xp professional.

thanks in advance for any help!!



All times are GMT +1. The time now is 11:37 AM.

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