Find a file folder name vba

Alpacino

Well-known Member
Joined
Mar 16, 2011
Messages
511
Hi I have a macro that extracts info from another file on my computer.
What I would like to do is share this workbook with my collegues on other computers. Problem I have is that the other users put the file where I get the info from is kept in different folders in their own computers. Eg on own it's in mydocuments\Alan's workfolder\figures.xls other user would be something like mydocuments\finance\figures.xls

My macro needs to know where the file is located. Does anyone know to find the folder name this file is in??

Thanks
Alan
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Can your users at least be instructed to save both the Excel Doc and this other file in the SAME folder?

If that is reasonable, then you can use

ThisWorkbook.Path
 
Upvote 0
I could do. Would it matter what the folder is called then in each user. They would probably save in the same folder anyway.
 
Upvote 0
No, it wouldn't matter...

As long as BOTH the file holding the macro, and the file the macro extracts data from are saved in the SAME folder, then ThisWorkbook.Path will work.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top