ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ThisWorkbook.Name returns a wrong workbook name (https://www.excelbanter.com/excel-programming/442570-thisworkbook-name-returns-wrong-workbook-name.html)

[email protected]

ThisWorkbook.Name returns a wrong workbook name
 
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.

Per Jessen

ThisWorkbook.Name returns a wrong workbook name
 
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

skrev i meddelelsen
...
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.




All times are GMT +1. The time now is 05:07 AM.

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