View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gareth[_6_] Gareth[_6_] is offline
external usenet poster
 
Posts: 158
Default 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!!