SetAttr Function - Modifying File Atrributes
Sub Changing_File_Attributes()
' Using the SetAttr Function, We can set the file as read-only or hidden etc
' Make the file Read-Only
SetAttr "c:\temp\Sample.txt", vbReadOnly
' Make the file Hidden
SetAttr "c:\temp\Sample.txt", vbHidden
' Please note that if you change one attribute, the existing attribute is overwritten. For making a file as both readonly and hidden use both attributes in the function
SetAttr "c:\temp\Sample.txt", vbHidden + vbReadOnly
' Remove all atributes - convert a read-only file to read-write file, unhide the file etc
SetAttr "c:\temp\Sample.txt", vbNormal
End Sub
Friday, May 04, 2007
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

set to read only, on-off (re: attribute set)
ReplyDeleteSetAttr "c:\temp\Sample.txt", vbReadOnly + vbArchive
SetAttr "c:\temp\Sample.txt", vbArchive
i need for it to turn readonly OFF to write to file then turn readonly ON
ReplyDelete