Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Refer to a sheet by (Name) rather than Name from an addin

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Refer to a sheet by (Name) rather than Name from an addin

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" wrote in message
...
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 module1
Book2 contains module2

'My code works in Module1 but not Module2
Sub Test
MsgBox RealSheetName.Name
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Refer to a sheet by (Name) rather than Name from an addin

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" wrote in messag
..
A sheet has 2 Name properties, "Name", which appears on the sheet tab, an

"(Name)"
I want the user to be able to change the "Name" of a worksheet and my cod

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Refer to a sheet by (Name) rather than Name from an addin

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)

"Rob" wrote in message
...
Thanks Bob. That was my first thought too, but I've tried:
Sub Test
MsgBox Book1.RealSheetName.Name
End Sub
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, 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" wrote in message
...
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 module1
Book2 contains module2
'My code works in Module1 but not Module2

Sub Test
MsgBox RealSheetName.Name
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
refer to range in another sheet Smallweed Excel Discussion (Misc queries) 5 November 13th 09 12:47 PM
copied formulas refer to destination sheet not source sheet Dantron Excel Worksheet Functions 2 October 21st 09 09:51 PM
How can I refer to sheet number not sheet (name)? DK Excel Worksheet Functions 2 March 30th 09 11:06 PM
Refer to Previous or Next Sheet build Excel Worksheet Functions 3 October 18th 07 05:38 AM
Refer new sheet to previous sheet Spot Excel Worksheet Functions 2 September 9th 05 02:05 PM


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"