Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change a file's attributes to read-only with vba? 2

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Will someone please show me how to change a local file's attributes from archive to read-only and visa versa?
I image it will be a shell call into the DOS????

Also. How do I copy a file from one location into another on the same drive?

Thanks,

Steve
 
Perhaps chewck out the FileScripting Object
Dim objFSO As New Scripting.FileSystemObject

as a solution for the File Move... Check to see if file exists first then delete before move...
If objFSO.FileExists(lcFName) = True Then 'Delete existing copy!
objFSO.DeleteFile lcFName
Utilities.DelayTime 5
End If

File Scripting may also off change of attribute to read-only function, but I've never had the need to use such an option... htwh,


Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
How are ya steve728 . . .

Here's an API with example that will do the job: SetFileAttributes API

Calvin.gif
See Ya! . . . . . .
 
Thanks folks! You always come through!

You both get stars!

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top