#1   Report Post  
nc
 
Posts: n/a
Default Readonly files

Hi

How do I change all the files in a specified directory
from a read only file to a non read only file usig
macros. The macro should take in account that some files
might not be read only.

Thanks.
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Sub ProcessFiles()
Dim sFolder As String
Dim Folder As Object
Dim file As Object
Dim Files As Object

Set FSO = CreateObject("Scripting.FileSystemObject")

sFolder = "C:\MyTest"
If sFolder < "" Then
Set Folder = FSO.GetFolder(sFolder)

Set Files = Folder.Files
For Each file In Files
If file.Attributes And 1 Then
'
Else
file.Attributes = file.Attributes + 1
End If
Next file

End If ' sFolder < ""

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"nc" wrote in message
...
Hi

How do I change all the files in a specified directory
from a read only file to a non read only file usig
macros. The macro should take in account that some files
might not be read only.

Thanks.



  #3   Report Post  
nc
 
Posts: n/a
Default

Bob

Thanks a lot.


-----Original Message-----
Sub ProcessFiles()
Dim sFolder As String
Dim Folder As Object
Dim file As Object
Dim Files As Object

Set FSO = CreateObject("Scripting.FileSystemObject")

sFolder = "C:\MyTest"
If sFolder < "" Then
Set Folder = FSO.GetFolder(sFolder)

Set Files = Folder.Files
For Each file In Files
If file.Attributes And 1 Then
'
Else
file.Attributes = file.Attributes + 1
End If
Next file

End If ' sFolder < ""

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"nc" wrote in

message
...
Hi

How do I change all the files in a specified directory
from a read only file to a non read only file usig
macros. The macro should take in account that some

files
might not be read only.

Thanks.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
csv files Jake Excel Discussion (Misc queries) 2 January 27th 05 06:07 PM
multiple text files URGENT tasha Excel Discussion (Misc queries) 1 December 19th 04 05:44 PM
importing multiple text files URGENT!!! HELP tasha Excel Worksheet Functions 0 December 19th 04 04:26 PM
importing multiple text files??? tashayu Excel Discussion (Misc queries) 0 December 19th 04 02:43 PM
Why does Excel saves all my files as temporary files? Arija Excel Discussion (Misc queries) 2 December 7th 04 11:38 PM


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"