View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Filter The msoFileDialogOpen

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

--
Regards,

OssieMac


"Mike" wrote:

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