View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brian Brian is offline
external usenet poster
 
Posts: 683
Default Limiting files to open to only files with certain name.

I have a User Form with a Control Button that is for opening Exsisting Files.
I only want to Open Files with the word "Spec" in the name? Is there a way to
only show & Open Excel Files with "Spec' in the name?

I have the following code that opens the Dialog Box, but it shows all the
files with the ".xlsm" extension. I want to narrow it down to only files with
"Spec" in the name. It would be nice if it would show all the differnt excel
file extensions.


' Open Existing Eng Spec 9 Control Button
Private Sub Open_Existing_Eng_Spec_9_Click()

FileToOpen = Application.GetOpenFilename("SPEC" (*.xlsm), *.xlsm")

If FileToOpen = False Then

MsgBox "The Open Method Failed, No Eng Spec was Opened", , "C.E.S."

Exit Sub

End If

Set bk = Workbooks.Open(Filename:=FileToOpen)
End Sub