How do I set a file to read only. There is an html document in my Temporary Internet Files directory that I'd like to make read only. However, Windows will not give me the option to do it.
Printable View
How do I set a file to read only. There is an html document in my Temporary Internet Files directory that I'd like to make read only. However, Windows will not give me the option to do it.
How about SetFileAttributes
Use SetAttr function.
Code:SetAttr "MyFile", vbReadOnly
Thanks guys I'll give it a shot.
Megatron,
what about un-read only
is it
set attr "myfile", vbNormal
??
Thanks
Wengang
wengang,
Yes. The vb intrinsic constants for file properties are:
The sum of these attributes defines the end result, so if you want a file to be read-only AND hidden, you do this:Code:vbNormal 0 Normal (default)
vbReadOnly 1 Read-only
vbHidden 2 Hidden
vbSystem 4 System file
vbArchive 32 File has changed since last backup
[Edited by seaweed on 10-11-2000 at 02:30 PM]Code:SetAttr "Path\FileName.ext", vbReadOnly + vbHidden
I have a data file that can be read my program, i save it as notepad file... how can i make it as write only when they click on the data file... but only readable and writeable by my program... thanks
Use encryption instead of SetAttr for that.