Filter The msoFileDialogOpen

M

Mike

Ive tried to filter this msoFileDialogOpen to only allow excel files to be
selected but cant get it to work. Any help ?
Set FD = Application.FileDialog(msoFileDialogOpen)
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.InitialFileName = "C:\"
.Title = "(Open excel file)"

If .Show = True Then
.Execute
Else
Exit Sub

End If
End With
 
O

OssieMac

Hi Mike,

Try this.

Dim FD
Set FD = Application.FileDialog(msoFileDialogOpen)
With Application.FileDialog(msoFileDialogOpen)
.Filters.Clear
.Filters.Add "Excel files", "*.*"

'or
'.Filters.Add "All files", "*.xls"

.AllowMultiSelect = False
.InitialFileName = "C:\"
.Title = "(Open excel file)"

If .Show = True Then
.Execute
Else
Exit Sub

End If
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top