Application.Filesearch will not cut it for what you want to do. You really
want a file system object. Here is some code to demonstrate them. Note that
in the
VB editor you need to reference "Microsoft Scripting Runtime" for this
to work. (Tools - References - Microsoft Scripting Runtime.
Sub ListFiles()
'Must reference "Microsoft Scripting Runtime" library
Dim fso As New FileSystemObject
Dim oCurrentFile As File
Dim oCurrentFolder As Folder
Dim wks As Worksheet
Dim rng As Range
On Error Resume Next
Set wks = Sheets("Sheet1")
Set rng = wks.Range("A2")
Set oCurrentFolder = fso.GetFolder("C:\FPA")
For Each oCurrentFile In oCurrentFolder.Files
rng.Value = oCurrentFile.Name
rng.Offset(0, 1).Value = oCurrentFile.ShortName
rng.Offset(0, 2).Value = oCurrentFile.Path
rng.Offset(0, 3).Value = oCurrentFile.DateCreated
rng.Offset(0, 4).Value = oCurrentFile.DateLastAccessed
rng.Offset(0, 5).Value = oCurrentFile.DateLastModified
rng.Offset(0, 6).Value = oCurrentFile.Size
rng.Offset(0, 7).Value = oCurrentFile.Type
rng.Offset(0, 8).Value = oCurrentFile.Attributes
Set rng = rng.Offset(1, 0)
Next oCurrentFile
End Sub
--
HTH...
Jim Thomlinson
"Eithne R" wrote:
Hi , I'm using the application.filesearch method in an Excel macro to
identify a list of Word and Excel files. I want to check the read-only and
password protection attributes of these word & Excel files and return a flag
to a populated list in Excel.
What object allows me access these attributes? Cheers.