View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jean-Yves[_2_] Jean-Yves[_2_] is offline
external usenet poster
 
Posts: 253
Default Open File showing only Excel files

Hi Tod,

You could use :
a = Application.GetOpenFilename
Search iin help on GetOpenFilename, you can adjust to restrict only to xl
files

"Todd Huttenstine" wrote in message
...
hey guys I want to be able to bring up an open file dialog
box that only looks for all microsoft excel type files.
You know how when you click open it has that option for
files of type. Thats the kind of thing I want to
automatically happen. What is the code for this?

I also have been using the Browse for folder code Chip
Pearson gave me below:
FName = BrowseFolder("Select a Workbook", "\\")
If FName = "" Then
GoTo SelectWorkbook
Else
'ComboBox.Value = FName
End If


Private Const BIF_RETURNONLYFSDIRS As Long = &H1
Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2
Private Const BIF_RETURNFSANCESTORS As Long = &H8
Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000
Private Const BIF_BROWSEFORPRINTER As Long = &H2000
Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000
Private Const MAX_PATH As Long = 260

Function BrowseFolder(Optional Caption As String, _
Optional InitialFolder As String) As String

Dim SH As Shell32.Shell
Dim F As Shell32.Folder

Set SH = New Shell32.Shell
Set F = SH.BrowseForFolder(0&, Caption,
BIF_RETURNONLYFSDIRS, _
InitialFolder)

If Not F Is Nothing Then
BrowseFolder = F.Items.Item.path
End If

End Function

Is there anyway with this code to show excel file types?

Thank you
Todd Huttenstine