Expand|Select|Wrap|Line Numbers
- Private Sub Command13_Click()
- Dim myDialog As FileDialog
- Dim strFile As String
- Dim strSearchPath As String
- Dim vrtSelectedItem As Variant
- Set myDialog = Application.FileDialog(msoFolderPicker)
- 'Use strSearchPath if you want to start in a particular directory. You can leave it out if you wish (as I have it commented out right now) and it will start with a default directory of Windows choosing.
- 'strSearchPath ="C:\SomeDirectory\SomeSubDirectory"
- With myDialog
- .AllowMultiSelect = True
- .Filters.Add "Excel Files", "*.xls", 1
- .Title = "Please Locate the Files to Import!"
- .InitialFileName = strSearchPath
- If .Show = -1 Then
- For Each vrtSelectedItem In .SelectedItems
- 'I pass the file information to another routine that handles the transfer
- ImportIt (vrtSelectedItem)
- Next vrtSelectedItem
- MsgBox "All data imported into the NewData Table." & vbCrLf & vbCrLf & "We will now post any new data into the data table!"
- Else
- 'The user pressed Cancel.
- End If
- Set myDialog = Nothing
- End With
- End Sub