rodrigo_m_almeida
New Member
- Joined
- Jan 13, 2022
- Messages
- 42
- Office Version
- 2021
- Platform
- Windows
Good Morning,
Needed to filter the selection of files by the initials of the filename and extension
Example :
Display files with ABC initials and CSV extension
ABC123.CSV
ABC321.CSV
ABCSCHOOL.CSV
ABCMEDIC.CSV
Etc...
Anyone have an idea how to do this ?
Needed to filter the selection of files by the initials of the filename and extension
Example :
Display files with ABC initials and CSV extension
ABC123.CSV
ABC321.CSV
ABCSCHOOL.CSV
ABCMEDIC.CSV
Etc...
VBA Code:
' Declare Variables
Dim xPathName As Variant, xFileName As String
' Browse File
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Select File:"
With .Filters
.Clear
.Add "Excel Files", "*.csv*" ' Search Filter <
End With
If .Show() Then xFileName = .SelectedItems(1) Else Exit Sub
End With
' Open File
Workbooks.Open Filename:=xFileName, Delimiter:=";", Local:=True
Anyone have an idea how to do this ?