View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dan E[_2_] Dan E[_2_] is offline
external usenet poster
 
Posts: 102
Default opening files

Brian,

What you need is the GetOpenFileName function.

Use it like

TheFileToOpen = Application.GetOpenFileName

TheFileToOpen will contain a string
Look in the help menu as you can use filters with it (among other things)
(ie only look for xls or txt files)
OpenWhat = Application.GetOpenFilename("Microsoft Excel Spreadsheets (*.xls), *.xls")

Dan E

"Brian" wrote in message ...
How do I write the VBA code to prompt the user to select a
file to open? In other words, I want the code to make
the Excel 'Open' window appear in order for the user to
browse for the appropriate file to open.

Thanks in advance!

Brian