Ask user a file name

L

Lucile

Hello,

I need to write a macro that asks the user the name of a excel file and then
copy a sheet of it into a new workbooks without opening the file.

I already start with this piece of code, but I do not know how to use the
file name:

file= Application.GetOpenFilename(FileFilter:="Excel Files (*.XLS), *.XLS", _
Title:="Select File To Be Opened")
If file = False Then _
Exit Sub

Thanks
 
B

Bob Phillips

You have to open it, no question about it. GetOpenFilename returns the
selected filename with full path which you can use to open the file, do your
copy, then close it.
 

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

Top