Good day OzGrid Nation!
I am currently working on a project that would perform backup up databases from an Excel worksheet. I am challenged at this point of searching the different directories for the files (File 1, File2, File 3) that need to be backed up and renamed into the Destination directory. I have managed to create the array that will look at the main drives to be search but creating a secondary array for the files to seek has proven difficult. Here is the code I used thus far:
Code
Sub OpenFolder()
Dim FileName As String
Dim fPath As String
Dim fDtName As String
Dim i As Long
Dim j As Long
Dim dbTarget As String
dbRosterFolder = ActiveWorkbook.Sheets("Production Dbs").Range("D1").CurrentRegion.Columns(5).Value
fDtName = Format(Now, "yyyy-mm-dd ")
' Loop through Db Roster locations
For i = 2 To UBound(dbRosterFolder)
' placeholder
Dim dbDirectoryContents() As String
ReDim dbDirectoryContents(1000)
dbTarget = Dir$(Cells(i, 4).Value)
Do While dbTarget <> ""
dbDirectoryContents(Counter) = dbTarget
dbTarget = Dir$
Counter = Counter + 1
Loop
Next i
End Sub
Display More