ThisWorkbook.Name returns a wrong workbook name

G

Guest

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.
 
P

Per Jessen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top