Paths when working with macros

  • Thread starter Thread starter merlin63
  • Start date Start date
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
 
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
 
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.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top