Open file from path in cell and open from current file path

Joined
Apr 27, 2011
Messages
2
Reaction score
0
Hi All,

I'm currently using this code below, but want to set the opening path based on cell A1. How do I incoporate it into the macro?

Also, another scenario, if I want open a file in the same directory as the working file. ie using command ThisWorkbook.path & "\" can it be done...

---------------------------------------------------------------------------------------------------------------------------

FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to import", _
FileFilter:="Excel Files *.xls (*.xls),")

If FileToOpen = False Then
MsgBox "No file selected", vbExclamation, "No File"

Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If


thanks
 

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