How to ask user for file to open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Hi
another way:
filename=Application.getopenfilename("Excel Files (*.xls), *.xls")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top