ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Relative import locations in macro (https://www.excelbanter.com/excel-programming/367869-relative-import-locations-macro.html)

rbmcclen[_4_]

Relative import locations in macro
 

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?


--
rbmcclen
------------------------------------------------------------------------
rbmcclen's Profile: http://www.excelforum.com/member.php...o&userid=36367
View this thread: http://www.excelforum.com/showthread...hreadid=563437


rbmcclen[_5_]

Relative import locations in macro
 

bump?

Someone surely knows if relative pathnames are possible in macros?


--
rbmcclen
------------------------------------------------------------------------
rbmcclen's Profile: http://www.excelforum.com/member.php...o&userid=36367
View this thread: http://www.excelforum.com/showthread...hreadid=563437



All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com