View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jos Vens Jos Vens is offline
external usenet poster
 
Posts: 52
Default Change ReadOnly State

Hi,

is it possible to change the state of a workbook from readonly to readwrite
and vice versa. The workbook is in explorer NOT set to readonly.

I had this in mind, but it doesn't work (code of a excel workbook One.xls)

Function Test() 'open a workbook in readonly mode

Workbooks.Open "c:\Two.xls", False, True

End Function

Function Test2()'After some time, change the state to read/write

Workbooks("Two.xls").ReadOnly = False
[A1] = "Test"
ActiveWorkbook.Save

End Function

Function Test3() 'After the update, change the state again to readonly

Workbooks("Two.xls").ReadOnly = True

End Function

Thanks
Jos Vens