How to ask user for file to open

D

Dwaine Horton

I have a template that I am putting a macro that will load data from another spreadsheet. However, I do not know what the other spreadsheet name will be. How can I ask the user to open the spreadsheet that contains the data

Thank

Dwaine Horto
York International
 
A

acw

Dwain

one way is to use an inputbox to request the information from the user. Something like
filetoget = InputBox("Enter the name of the file to open.", , "c:\temp\filetoopen.xls"

This will give a variable with the filename (including path if required) which can then be used to open the file
Workbooks.Open FileName:=filetoge

Ton

----- Dwaine Horton wrote: ----

I have a template that I am putting a macro that will load data from another spreadsheet. However, I do not know what the other spreadsheet name will be. How can I ask the user to open the spreadsheet that contains the data

Thank

Dwaine Horto
York International
 
F

Frank Kabel

Hi
another way:
filename=Application.getopenfilename("Excel Files (*.xls), *.xls")
 
Top