Hi,
You can use the file system object to search through system folders
try this along with the GetWrdChars function.
Function InspectDocs(strPath As String, IncludeSubfolders As Boolean)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsFolder = fso.GetFolder(strPath)
Set fsSubFolders = fsFolder.SubFolders
Set fsFiles = fsFolder.Files
For Each File In fsFiles 'Get the files in this folder
If Right(Trim(File.Name), 3) = "doc" Then 'Only check word files
'Do something with the data
MsgBox File.Path & " has " & GetWrdChars(File.Path) & " characters"
End If
Next
If IncludeSubfolders Then 'Get the files in sub folders
For Each Subfolder In fsSubFolders
Set fsFolder = fso.GetFolder(Subfolder)
Set fsFiles = fsFolder.Files
For Each File In fsFiles 'Get the files in this folder
If Right(Trim(File.Name), 3) = "doc" Then 'Only check word files
'Do something with the data
MsgBox File.Path & " has " & GetWrdChars(File.Path) & " characters"
End If
Next
Next
End If
Set fso = Nothing
Set fsFolder = Nothing
Set fsSubFolder = Nothing
Set fsFile = Nothing
End Function
Jon
|