Costas
Member
Hi Chandoo,
I'm trying to filter the file name to contain a specific string so it only shows files that have this string.
When I try it I get a run-time error 5, invalid procedure call or argument
Here is my code:
Any ideas where I'm going wrong?
Thanks
Costas
I'm trying to filter the file name to contain a specific string so it only shows files that have this string.
When I try it I get a run-time error 5, invalid procedure call or argument
Here is my code:
Code:
Public MyFullPath as String
Public Const MyLocation As String = "SYD"
Sub FileOpenDialogBox()
With Application.FileDialog(msoFileDialogFilePicker)
'Makes sure the user can select only one file
.AllowMultiSelect = False
.Filters.Add "Excel files", MyLocation & "*.xlsx; *.xls", 1
.Show
MyFullPath = .SelectedItems.Item(1)
End With
Workbooks.Open FileName:=MyFullPath
MyFileName = ActiveWorkbook.Name
End Sub
Thanks
Costas
Last edited by a moderator: