View Single Post
  #3   Report Post  
Christopher Blue
 
Posts: n/a
Default

I am importing external data by using Data \ Import External Data \ Import
Data...

I then pick the .csv file from the file selection dialog that appears.
However, the location is absoute instead of relative like I would like.
Also, I cannot seem to edit the location of the external data directly (Excel
only gives me another file selection dialog).

Basically if the location of the .csv was relative I could move the
directory where I have the workbook and the .csv anywhere I want. As it
stands, moving the directory breaks the link the workbook has to the .csv.

And the reason I use external data is because I have my own pet program edit
the .csv directly (it's really easy to understand). I have no idea how to
edit an Excel worksheet directly nor would I want to so I use externally
linked data.

"Dave Peterson" wrote:

I'm not quite sure what you're doing.

But if you're doing this from a macro, maybe you could just use
application.getopenfilename. It would allow you to browse for your file.

Or if the .csv file is in the same location as the workbook that contains the
macro, you could find the path of that workbook by using

thisworkbook.path

So you could use...

dim myCSVFileName as string
mycsvfilename = thisworkbook.path & "\filename.csv"



Christopher Blue wrote:

I know how to import external data from a .csv, but how can I have the path
be relative so I can move the directory around without having to update the
.csv file location manually?


--

Dave Peterson