I have a formula to pull the workbook name but is there a way to do it in code?
I have a formula to pull the workbook name but is there a way to do it in code?
Hi Ceemo,
Try Activeworkbook.Name also if you also need location you could use
Activeworkbook.FullName.
James
ceemo wrote:
> I have a formula to pull the workbook name but is there a way to do it
> in code?
>
>
> --
> ceemo
> ------------------------------------------------------------------------
> ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
> View this thread: http://www.excelforum.com/showthread...hreadid=548546
You can use ActiveWorkbook.Name or .FullName to return the name
or full name of the workbook that is active, regardless of what
workbook contains the code. You can use ThisWorkbook.Name or
..FullName to return the name of the workbook which contains the
code, regardless of what is active.
If you are going to be calling this from a worksheet cell, use
Function WorkbookName() As String
WorkbookName = Application.Caller.Parent.Parent.Name
End Function
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"ceemo" <ceemo.28xjda_1149511801.2716@excelforum-nospam.com>
wrote in message
news:ceemo.28xjda_1149511801.2716@excelforum-nospam.com...
>
> I have a formula to pull the workbook name but is there a way
> to do it
> in code?
>
>
> --
> ceemo
> ------------------------------------------------------------------------
> ceemo's Profile:
> http://www.excelforum.com/member.php...o&userid=10650
> View this thread:
> http://www.excelforum.com/showthread...hreadid=548546
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks