Relative import locations in macro

R

rbmcclen

Hi,
How do I make the text import location of a file relative to the
location of the workbook?

My macro imports a text file 01.txt from the same location the workbook
is located:

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Project\07 July\01.txt", Destination _
:=Range("C2"))

So that I can move the spreadsheet to other folders containing the same
named files and it still work?
 

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