D
djharrison
I have managed to populate a dropdown box with a list of all files in
the current folder and even filtered them by the extension so that it
only displays the .mdb files. However, the menu seems to be holding
all of the items in the folder and displaying only the .mdb. This
seems to be a problem with the way I am defining the size of the
array. If I add my .mdb filter to the array loop I get an 'out of
range' error for the n variable?? Can anyone suggest a solution??
'Find Number of Files
varFileCount = 0
For Each objFile in objFolder.Files
varFileName = objFSO.GetFileName(objFile.Name)
varFileType = objFSO.GetExtensionName(objFile.Name)
If (Left(varFileType, 3) = "mdb") Then
varFileCount = varFileCount + 1
End if
Next
' Put File Names into an Array
ReDim varFileNames(varFileCount)
n = 0
For Each objFile in objFolder.Files
n = n + 1
' varFileName = objFSO.GetFileName(objFile.Name)
' varFileType = objFSO.GetExtensionName(objFile.Name)
' If (Left(varFileType, 3) = "mdb") Then
varFileNames(n) = objFile.Name
' End If
Next
the current folder and even filtered them by the extension so that it
only displays the .mdb files. However, the menu seems to be holding
all of the items in the folder and displaying only the .mdb. This
seems to be a problem with the way I am defining the size of the
array. If I add my .mdb filter to the array loop I get an 'out of
range' error for the n variable?? Can anyone suggest a solution??
'Find Number of Files
varFileCount = 0
For Each objFile in objFolder.Files
varFileName = objFSO.GetFileName(objFile.Name)
varFileType = objFSO.GetExtensionName(objFile.Name)
If (Left(varFileType, 3) = "mdb") Then
varFileCount = varFileCount + 1
End if
Next
' Put File Names into an Array
ReDim varFileNames(varFileCount)
n = 0
For Each objFile in objFolder.Files
n = n + 1
' varFileName = objFSO.GetFileName(objFile.Name)
' varFileType = objFSO.GetExtensionName(objFile.Name)
' If (Left(varFileType, 3) = "mdb") Then
varFileNames(n) = objFile.Name
' End If
Next