Excel VBA efficient get file names function -


I need to get a collection of file names from a folder on a remote server using VBA in Excel 2010. I have a function that works and in most cases this job will be done, although the remote server often has terrible, terrible network performance issues, it means that to keep 300 files in the archive It may take up to 10 minutes, the number of files in folders is likely to increase to thousands, so it is not working, I want a way to get all the file names on a single network Do not have more looping in the request. I believe it is connecting to a remote server which is taking time, so a single request should be able to get all the files in a file quite quickly.

This is currently the function I have:

  GetFileNames (spath as String) as a collection of private functions' takes a path and one of the file names in the folder The collection gives the object dim ophile object dim osso object dim columnist new collection set oFSO = CreateObject ("Scripting.FileSystemObject") as OMAT DIM opiler oFolder = oFSO.GetFolder (folderPath: = sPath) oFolder for each oFile. Set ColList.Add oFile.Name in the Files Next NextGetFileNames = colList Set oFolder = nothing set OFSO =  

code> sub filetest () dim x () string Debug as the x = function_file list ("YOUR_PATH_AND_FOLDER_NAME"). Join in print (x, vbcrlf) and sub

which says this function:

  function n Function_FileList (string as folder location) Function_FileList = Filter (CreateObject ("wscript.shell"). Exec ("cmd / c Dir" and "Folder Location" and "" "/ B / A-D-Dक्टर.Studout.Readle, VBCRLF ), ".") Termination function    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -