Refer to a sheet by (Name) rather than Name from an addin

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A sheet has 2 Name properties, "Name", which appears on the sheet tab, and "(Name)"

I want the user to be able to change the "Name" of a worksheet and my code still work. This is no problem if I refer to the sheet using the "(Name)" property, but if I try to refer to the sheet in this way from another workbook then it doesn't work. Can anyone tell me why

Book1 contains the sheet: RealSheetName(User's Sheet Name
and module
Book2 contains module

'My code works in Module1 but not Module
Sub Tes
MsgBox RealSheetName.Nam
End Su
 
This property is called the CodeName. To access from anothjre workbook, you
have to add the (owning) workbook name as well.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Rob said:
A sheet has 2 Name properties, "Name", which appears on the sheet tab, and "(Name)".

I want the user to be able to change the "Name" of a worksheet and my code
still work. This is no problem if I refer to the sheet using the "(Name)"
property, but if I try to refer to the sheet in this way from another
workbook then it doesn't work. Can anyone tell me why?
 
Thanks Bob. That was my first thought too, but I've tried
Sub Tes
MsgBox Book1.RealSheetName.Nam
End Su
and still have the problem. (If that's what you meant..?



----- Bob Phillips wrote: ----

This property is called the CodeName. To access from anothjre workbook, yo
have to add the (owning) workbook name as well

--

HT

Bob Phillip
... looking out across Poole Harbour to the Purbeck
(remove nothere from the email address if mailing direct

Rob said:
A sheet has 2 Name properties, "Name", which appears on the sheet tab, an "(Name)"
still work. This is no problem if I refer to the sheet using the "(Name)
property, but if I try to refer to the sheet in this way from anothe
workbook then it doesn't work. Can anyone tell me why
 
No I mean

MsgBox Workbooks("Book1.xls").RealSheetName.Name

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Back
Top