Watch this example on YouTube
The following code will make file read only
Sub TestFile()
Dim FileName As String
Dim FileObject As Object
Dim FileSystem As Object
FileName = "C:\Temp\ExcelTest\ReadOnly.txt"
Set FileObject = CreateObject("Scripting.FileSystemObject")
Set FileSystem = FileObject.GetFile(FilePath:=FileName)
FileSystem.Attributes = 1
End Sub
No comments:
Post a Comment