Excel connection string - relative path

Hi All,

I have a connection string in an Excel Spreadsheet that links to other spreadsheets. All works well. However, the file and directory are written as absolute. Can this be relative?

There are two files in the same directory N:\Files\ProjectName\Clients\Alpha\Project.xlsm and N:\Files\ProjectName\Clients\Alpha\Data1.xlsm and on in another directory N:\Files\ProjectName\Clients\Beta\Data2.xlsm

The connection strings are:

DSN=Excel Files;DBQ=N:\Files\ProjectName\Clients\Alpha\Data1.xlsm;DefaultDir=N:\Files\ProjectName\Clients\Alpha


DSN=Excel Files;DBQ=N:\Files\ProjectName\Clients\Beta\Data2.xlsm;DefaultDir=N:\Files\ProjectName\Clients\Beta

I want it to work without the n:\ reference?

eg similar to:

DSN=Excel Files;DBQ=..\Data1.xlsm;DefaultDir=..\Alpha (Because it's in the same directory) and

DSN=Excel Files;DBQ=...\Beta\Data2.xlsm;DefaultDir=...\Beta (because it is in the next directory)

Any advise welcomed.

Cheers, Graeme

edit delete
are you sure?
asked Graeme Townsend

0 answers

Post an answer but please login first

Post Answer
  1. Please login to post answer

Similar Questions

Tagsfor this question

Forumall questions