View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Adding a popup to specify a filename

Steve,

Have a look at the GetOpenFilename method. E.g.,

Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files,*.xls")
If FName = False Then
MsgBox "You didn't choose a file"
Else
MsgBox "You chose file: " & FName
End If

Note that GetOpenFilename doesn't actually open the file. It displays a
standard File Open dialog and returns the name of the file selected by the
user.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Steve" wrote in message
...
I have a macro that reads in a file. The file's name
changes every day when the date is appended. How can I
change my macro so that instead of always calling
MyFile.xls it prompts the user to type in the filename? I
can't make it call in MyFile_with_today's_date.xls because
sometimes I have to run the macro on old files.
Thanks