ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the folder name of thisworkbook (https://www.excelbanter.com/excel-programming/412809-how-get-folder-name-thisworkbook.html)

edward

How to get the folder name of thisworkbook
 
Hi,

I need some help,
How do i get the name of the folder where my .xls contain
i do not need the whole path just the folder where this active .xls is in.

file will be save in different folder, therefore i need the macro to just
get the direct folder of where this .xls is in.

Bob Phillips[_3_]

How to get the folder name of thisworkbook
 
Dim Foldername As String

With ThisWorkbook

Foldername = Right$(.Path, Len(.Path) - InStrRev(.Path,
Application.PathSeparator))

MsgBox Foldername
End With


--
__________________________________
HTH

Bob

"Edward" wrote in message
...
Hi,

I need some help,
How do i get the name of the folder where my .xls contain
i do not need the whole path just the folder where this active .xls is in.

file will be save in different folder, therefore i need the macro to just
get the direct folder of where this .xls is in.




edward

How to get the folder name of thisworkbook
 
Thanks Bob,

You help me exactly what i wanted, really appreciated





"Bob Phillips" wrote:

Dim Foldername As String

With ThisWorkbook

Foldername = Right$(.Path, Len(.Path) - InStrRev(.Path,
Application.PathSeparator))

MsgBox Foldername
End With


--
__________________________________
HTH

Bob

"Edward" wrote in message
...
Hi,

I need some help,
How do i get the name of the folder where my .xls contain
i do not need the whole path just the folder where this active .xls is in.

file will be save in different folder, therefore i need the macro to just
get the direct folder of where this .xls is in.






All times are GMT +1. The time now is 11:28 AM.

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