I get the following error:
User defined type not defined
... on the first line of the following code:
Dim fDialog As Office.FileDialog
Dim txtFilePath As String
txtFilePath = ""
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = "Select the file you want to import"
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "CSV Files", "*.CSV"
If .Show = -1 Then
txtFilePath = .InitialFileName
Else
Exit Function
End If
End With
FileDialog = txtFilePath
How do I link to this "Office" library or is there a better way to get a file dialog?