ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting Path Of .XLS? (https://www.excelbanter.com/excel-programming/411111-getting-path-xls.html)

PeteCresswell[_2_]

Getting Path Of .XLS?
 
I'm trying to get the complete path to the .XLS my VBA code is running
in.

Actually, I just need the directory.... but either would do.

So far, all I'm able to get is the application's directory (where
Excel lives).

??

Chip Pearson

Getting Path Of .XLS?
 
You can use either

ThisWorkbook.Path
' or
ActiveWorkbook.Path


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"PeteCresswell" wrote in message
...
I'm trying to get the complete path to the .XLS my VBA code is running
in.

Actually, I just need the directory.... but either would do.

So far, all I'm able to get is the application's directory (where
Excel lives).

??



SixSigmaGuy[_3_]

Getting Path Of .XLS?
 
Be careful using ActiveWorkbook. The ActiveWorkbook can change while your
code is running and might not be the one you expected when you query the
path property.

"Chip Pearson" wrote in message
...
You can use either

ThisWorkbook.Path
' or
ActiveWorkbook.Path


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"PeteCresswell" wrote in message
...
I'm trying to get the complete path to the .XLS my VBA code is running
in.

Actually, I just need the directory.... but either would do.

So far, all I'm able to get is the application's directory (where
Excel lives).

??





All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com