View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default Help with getting filenames & then checking for new

Here is some code to show you how to open all files in a folder


Dim oFSO

Sub LoopFolders()

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub


'---------------------------------------------------------------------------
Sub selectFiles(sPath)
'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr

For Each file In Folder.Files
If file.Type Like "Microsoft*Excel*Worksheet*" Then
Workbooks.Open Filename:=file.Path

'do something

Activeworkbook.Close SaveChanges:=False
End If
Next file

End Sub


--
__________________________________
HTH

Bob

"DonW" wrote in message
...
Hey all,

I have a number of files on a server (in different directories) that are
periodically updated/added to by other users.

(1) I need to programatically build a list of those filenames and then
(2) to compare the above list to what's on the server and if any are new
(on the server) to get the new filename(s) and file parameters
(such as if it were a music list, then filename, artist, modified
date, etc., etc.).

I'm really hoping I don't have to type all of the current filenames and
parameters into the list first.

Thanks sooooooo much for any help,
Don