January 31, 2006 at 9:31 am
I'm creating text files using an DTS ActiveX script task and I'd like to write protect them. I'm creating the file using the FileSystemObject--
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("c:\myfile.txt")
objFile.attributes = 1
(1 being read-only) The code blows up on the attributes line stating "Object doesn't support this object or method: 'objFile.attributes'. I've seen many references online stating that this is the way to go but it's not working for me. Definitely seems like it would thou, right? Anyone know what I'm doing wrong except not starting my own company, creating software that everyone needs, and selling it to Microsoft so I can retire rich and happy?
January 31, 2006 at 1:06 pm
Before anyone goes hog wild on this, I found my error. 'CreateTextFile' returns a TextStream, not a file. By immediately calling 'Set objMyFile = objFSO.GetFile("c:\myfile.txt")' which does return a file, I can work the attributes as needed. My mistake. Thanks for your thoughts.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply