View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Brad Vontur[_2_] Brad Vontur[_2_] is offline
external usenet poster
 
Posts: 16
Default Read only without password

I'm not sure if there's a way to make a file read only in Excel, but you can do it with the FileSystemObject of the Scripting library. Try the following procedure

Sub MakeReadyOnly(strFile As String
' strFile should resemble c:\Book1.xl

Dim fso As Objec
Dim file As Objec

Set fso = CreateObject("Scripting.FileSystemObject"
Set f = fso.GetFile(strFile

f.Attributes = 1 ' 1 is read only. 32 is archive. 32 + 1 is 33 for Archive and ReadOnl

Set fso = Nothin
Set f = Nothin
End Su

-Brad Vontur