From: NoSpam on
I am using Excel 2003 and an addin I have written. When I use
ThisWorkbook.Name in my code, it returns the name of the addin, not the
name of the workbook I have open.

How can I get the name of the workbook, not the addin?

Many thanks.
From: Michelle on
Refer to the open workbook as: 'ActiveWorkbook'

ThisWorkbook always refers to the one that the copde is in

Cheers

M


<NoSpam(a)aol.com> wrote in message
news:bokpu5hh8scb791j6eafur5odj4bejbph3(a)4ax.com...
>I am using Excel 2003 and an addin I have written. When I use
> ThisWorkbook.Name in my code, it returns the name of the addin, not the
> name of the workbook I have open.
>
> How can I get the name of the workbook, not the addin?
>
> Many thanks.

From: Per Jessen on
ThisWorkbook will always refer to the workbook where the macro is.

You can use ActiveWorkbook.Name to return the name of the active workbook.

Regards,
Per

<NoSpam(a)aol.com> skrev i meddelelsen
news:0sqpu59qvar159eojdabrublhthpvud39j(a)4ax.com...
> I am using Excel 2003 and an addin I have written. When I use
> ThisWorkbook.Name in my code, it returns the name of the addin, not the
> name of the workbook I have open.
>
> How can I get the name of the workbook, not the addin?
>
> Many thanks.

From: NoSpam on
Thanks for the replies. Your solution is easy and it works.
On Fri, 14 May 2010 02:19:29 -0400, NoSpam(a)aol.com wrote:

>I am using Excel 2003 and an addin I have written. When I use
>ThisWorkbook.Name in my code, it returns the name of the addin, not the
>name of the workbook I have open.
>
>How can I get the name of the workbook, not the addin?
>
>Many thanks.