Paths when working with macros

M

merlin63

Greetings,

I recently recorded a macro that I use to import data from the sam
directory that my spreadsheet resides in. After recording, the macr
gives the full path to the spreadsheet and the Microsoft Acces
database that I am using (i.e. C:\Stuff\Morestuff\myspreadsheet.xls).

This prevents me from simply moving the files to another computer t
use, since the other computer may not be running the import in the sam
location on the hard drive.

How do I tell the spreadsheet not go to a specific directory and jus
look for the files it needs in the same directory that the origina
spreadsheet resides?

Thanks
 
B

BrianB

Leave out the path, just use the workbook name. Excel automaticall
looks in the local folder first (unless you have changed i
subsequently by navigating to another folder via File/Open o
whatever). :-

myspreadsheet.xl
 
J

Jamie Collins

merlin63 wrote ...
How do I tell the spreadsheet not go to a specific directory and just
look for the files it needs in the same directory that the original
spreadsheet resides?

Use:

ThisWorkbook.Path

Jamie.

--
 
Top