Hi all,
I'm looking for a VBA function that will loop through a directory, and store every *.pub file into an array. I want each value in the array to be the full path to the *.pub file, not just the name.
In Office 2003 I used to do the following, but .FileSearch does not work in office 2007:
I'm looking for a VBA function that will loop through a directory, and store every *.pub file into an array. I want each value in the array to be the full path to the *.pub file, not just the name.
In Office 2003 I used to do the following, but .FileSearch does not work in office 2007:
Code:
Sub GrabTextFromDashboards(DBPath As String, TXTPath As String)
Application.ScreenUpdating = False
Dim intCount As Integer
Dim arrFiles() As String
Dim arrFileNames() As String
Dim strPath, strName, strFilePath As String
Dim strWriteup As String
Dim lngPathLen As Long
strPath = DBPath
lngPathLen = Len(strPath)
With Application.FileSearch
.NewSearch
.FileName = "*.pub"
.LookIn = strPath
.Execute
For intCount = 1 To .FoundFiles.Count
Next intCount
ReDim arrFiles(1 To intCount) As String
ReDim arrFileNames(1 To intCount) As String
'********** Stores the path of all files into an Array
For intCount = 1 To .FoundFiles.Count
arrFiles(intCount) = .FoundFiles(intCount)
Next intCount
.
.
.