ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   file location, defaults (https://www.excelbanter.com/excel-programming/306260-file-location-defaults.html)

bob

file location, defaults
 
Hi and thank you in advance..

I am trying to create an xls file that automatically
imports from CSV on open... This works well, BUT I want
to be able to duplicate this is other folders without
rewriteing the script...

This is part of what I have working

With ActiveSheet.QueryTables.Add_
(Connection:="TEXT;F:\APPS\FVBU\zList\userlist.csv ", _
Destination:=Range("A1"))

IT wont work without specifying the full path...
Is there a variable that holds the path to the XLS file
that is open...
The VSC and XLS will always be in the same folder...
Thank you....

Tom Ogilvy

file location, defaults
 
With ActiveSheet.QueryTables.Add_
(Connection:="TEXT;" & ThisWorkbook.Path & "\userlist.csv", _
Destination:=Range("A1"))


--
Regards,
Tom Ogilvy

"bob" wrote in message
...
Hi and thank you in advance..

I am trying to create an xls file that automatically
imports from CSV on open... This works well, BUT I want
to be able to duplicate this is other folders without
rewriteing the script...

This is part of what I have working

With ActiveSheet.QueryTables.Add_
(Connection:="TEXT;F:\APPS\FVBU\zList\userlist.csv ", _
Destination:=Range("A1"))

IT wont work without specifying the full path...
Is there a variable that holds the path to the XLS file
that is open...
The VSC and XLS will always be in the same folder...
Thank you....




bob

file location, defaults
 
THANK YOU!! that's it!!!
-----Original Message-----
With ActiveSheet.QueryTables.Add_
(Connection:="TEXT;" & ThisWorkbook.Path

& "\userlist.csv", _
Destination:=Range("A1"))


--
Regards,
Tom Ogilvy

"bob" wrote in

message
...
Hi and thank you in advance..

I am trying to create an xls file that automatically
imports from CSV on open... This works well, BUT I want
to be able to duplicate this is other folders without
rewriteing the script...

This is part of what I have working

With ActiveSheet.QueryTables.Add_
(Connection:="TEXT;F:\APPS\FVBU\zList\userlist.csv ", _
Destination:=Range("A1"))

IT wont work without specifying the full path...
Is there a variable that holds the path to the XLS file
that is open...
The VSC and XLS will always be in the same folder...
Thank you....



.



All times are GMT +1. The time now is 08:10 PM.

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