Posted to microsoft.public.excel.programming
|
|
Selecting File and FilePath
Thanks very much. Exactly what I wanted, just couldn't find it using help or
the books.
Cheers,
Pete
"Chip Pearson" wrote in message
...
Peter,
You can use the GetOpenFilename procedure to do this. E.g.,
Dim FName As Variant
FName = Application.GetOpenFilename("Text Files (*.txt),*.txt", , , ,
False)
If FName = False Then
MsgBox "No File Selected"
Else
MsgBox "You chose: " & FName
End If
Note that GetOpenFilename does not actually open the file. It simply
returns the full file name selected by the user, or False if the user hits
cancel.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Peter Harrison" wrote in message
...
Hope somebody can help, can not find the answer in my books...
I am used to coding for XL95 but now have to use XL2000 (I prefer it but
I'm
not used to it, the boss wants everything done yesterday)
I want to be able to select a file and file path using a built-in dialog
box
and the file,filepath variables to be used in the procedure.
To be more specific, I want to import data from a text file, but rather
than
forcing the user to have the text file in a specific place I want to
allow
the user to select the file and where it is on their computer, the
import
procedure will then use the supplied filepath/filename for importing the
data.
In XL95 I could use the open file dialog, select the file then when the
dialog was dismissed the file was not opened but the information
gathered
could be used in the procedure. Can something like this be done in
XL2000?
any help would be appreciated.
--
TIA
Pete
|