Hello everyone,
I'm just starting out learning how to program in VBA, and could use some help. Right now I'm trying to pull in an Excel file into Access and have some code for a dialog box that allows the user to search for a specific file. However, the file is nested deep within a folder structure, and takes forever to get to. I was wondering if there was a way to modify my code (or just new code altogether) that allows the user to search for a specific file, but gives me the option of starting at a set folder.
Thanks!
Current Code:
Public Sub cmdFindFile(intX As Integer)
Dim strImport As String
Dim FD As FileDialog
Dim FFs As FileDialogFilters
Dim vrtFileName As Variant
Set FD = Application.FileDialog(msoFileDialogFilePicker)
With FD
Set FFs = .Filters
With FFs
.Clear
.Add "Comma Delimited", "*.csv"
.Add "Excel", "*.xls"
End With
.AllowMultiSelect = False
If .Show = False Then Exit Sub
For Each vrtFileName In .SelectedItems
Select Case intX
Case 1: Forms!NC_Scorecard.Text = vrtFileName
'Case 2: Me.txtManifest = vrtFileName
End Select
Next vrtFileName
End With
End Sub
Bookmarks