From: confused on
In excel vba I want to add a line that displays the name of the workbook on a
summary sheet

Is there an automatic way to add the name without typing it in

here's what I have so far:
'Enter Name
..Range ("B1") = "NAME"

Thank you in advance !!!


From: Mike H on
Hi,

The first line puts the name in a cell the second one puts the full path and
name

Sheets("Sheet1").Range("A1") = ThisWorkbook.Name
Sheets("Sheet1").Range("A2") = ThisWorkbook.FullName
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"confused" wrote:

> In excel vba I want to add a line that displays the name of the workbook on a
> summary sheet
>
> Is there an automatic way to add the name without typing it in
>
> here's what I have so far:
> 'Enter Name
> .Range ("B1") = "NAME"
>
> Thank you in advance !!!
>
>
From: Gary Brown on
=CELL("Filename")
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"confused" wrote:

> In excel vba I want to add a line that displays the name of the workbook on a
> summary sheet
>
> Is there an automatic way to add the name without typing it in
>
> here's what I have so far:
> 'Enter Name
> .Range ("B1") = "NAME"
>
> Thank you in advance !!!
>
>
From: Chip Pearson on
>=CELL("Filename")

Be careful with that. If another workbook is active when Excel
calculates the formula, that will return the name of the active
workbook, not the name of the workbook containing the formula. You can
force it to use the workbook containing the formula with

=CELL("filename",A1)

It doesn't matter what cell you pass to CELL; just pass any cell that
is in the workbook whose name you want to retrieve.\


Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Fri, 12 Mar 2010 13:00:01 -0800, Gary Brown
<GaryBrown(a)discussions.microsoft.com> wrote:

>=CELL("Filename")