Db-why-not
Registered User.
- Local time
- Today, 02:22
- Joined
- Sep 17, 2019
- Messages
- 160
I have a form where you click a button then it opens a windows filepicker dialog box. I want the dialog box to show Excel files and CSV files in the filepicker. Right now only the excel files are showing up in the dialog box. I even tried converting the CSV file to excel file and they still didn't show up. Below is my current code.
Code:
Private Sub cmdSelectFiles2_Click()
' Make sure under Tools Reference- Microsoft Office 15.0 or 16.0 Object Library is checked
Dim fd As FileDialog
Dim item As Variant
Set fd = Application.FileDialog(msoFileDialogOpen)
With fd
.AllowMultiSelect = False
.Title = "Please select an Excel Spreadsheet"
.Filters.Clear
.Filters.Add "Excel Spreadsheets", "*.xls, *.xlsx"
.Filters.Add "Comma Separated File", "*.csv, *.txt"
If .Show Then
For Each item In .SelectedItems
Me.txtFileNameT = item
Next
End If
End With
End Sub