Try:
ThisFolder = ActiveWorkbook.Path
If the workbook has been saved, this will give the folder in which it is
saved. You don't need to use ActiveWorkbook if you have a reference already
to the workbook for which you wish to receive the path.
There is also an Application.Path property which gives the path to where
the application is run from.
Are you wanting the folder of a specific workbook that you load or some
other folder?
Steve
For information and sample code for integrating Office with Visual Basic,
Visual C++, Internet Scripts, and other programming languages, please see
http://msdn.microsoft.com/library/techart/VSOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.
Best regards,
Steve Danielson
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? Please visit the Microsoft Security & Privacy Center
(
http://www.microsoft.com/security) for the latest news on security updates.