ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with getting filenames & then checking for new (https://www.excelbanter.com/excel-programming/428398-help-getting-filenames-then-checking-new.html)

DonW[_2_]

Help with getting filenames & then checking for new
 
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



Bob Phillips[_3_]

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





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com