Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Relative Path in Connection String

I am using Excel 2007 to import data from another Excel workbook using
Microsoft Query 2000. The solution works well with a fixed path, but I would
like the connection string to use a relative path (for example the current
directory) so that the files can be copied to a different location and still
function.

I have seen a number of web questions about this topic, but most involve a
programming solution. Is this possible just using Excel? Eg. to specify an
ODBC connection string that would solve the problem.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Relative Path in Connection String

Not possible without resorting to code...
--
HTH...

Jim Thomlinson


"Breunus" wrote:

I am using Excel 2007 to import data from another Excel workbook using
Microsoft Query 2000. The solution works well with a fixed path, but I would
like the connection string to use a relative path (for example the current
directory) so that the files can be copied to a different location and still
function.

I have seen a number of web questions about this topic, but most involve a
programming solution. Is this possible just using Excel? Eg. to specify an
ODBC connection string that would solve the problem.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 272
Default Relative Path in Connection String

Relative paths can be used in connection strings (as well as formulas and
dialog boxes) but you need to be careful as they are relative to the active
folder¹. So if you were to include a filename without a path it would need to
be in the active folder.

To make sure the current workbook folder is activate you can try choosing
Save As then Cancel, then run the query.

¹ Excel makes a distinction between active folder and workbook folder, which
can be seen from their VBA equivalents: curdir and activeworkbook.path. The
active folder is the one that you see when you click File Open, it can be
changed simply by selecting another folder and cancelling.



"Breunus" wrote:

I am using Excel 2007 to import data from another Excel workbook using
Microsoft Query 2000. The solution works well with a fixed path, but I would
like the connection string to use a relative path (for example the current
directory) so that the files can be copied to a different location and still
function.

I have seen a number of web questions about this topic, but most involve a
programming solution. Is this possible just using Excel? Eg. to specify an
ODBC connection string that would solve the problem.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative path in database query connection string DanL Excel Discussion (Misc queries) 1 February 20th 09 06:09 PM
Relative Path to a Folder Heliocracy Excel Discussion (Misc queries) 3 October 3rd 07 04:28 PM
How do I use a connection string? BrandenK Excel Discussion (Misc queries) 0 September 25th 07 07:10 PM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
Absolute vs Relative path K2H Excel Discussion (Misc queries) 2 July 28th 05 12:50 PM


All times are GMT +1. The time now is 07:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"