Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default (Name) Property Under VBA Control

If you select a sheet and look at the Properties, you will find two properties that name the sheet:
(Name)
Name

When a user changes the sheet name by typing into the sheet Tab, they are changing the Name property, but not the (Name) property.

Example: When you open a new workbook, Sheet1 will have properties:
(Name) = "Sheet1"
Name ="Sheet1"
When the user renames that sheet to "Revenues" the properties become:
(Name) = "Sheet1"
Name = "Revenues"

You can rename the (Name) property directly in the Properties table for the sheet, however, I would like to read (and even write) that property in VBA, but the only methods I can find are for the Name property. Anybody know how to do this?

Thanks, Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default (Name) Property Under VBA Control

the other name is the 'CodeName' of the VBProject

in Tools/References, browse to:
Visual Basic for Applications Extensibility 5.3

checkmark it. press ok.
now open the object browser (F2)
dropdown to VBIDE and you can see all the props that you can program
...

in Excel:
in macro security(2nd tab) you must check
'Allow access to VB object model'

now you're up and running and you can start learning how to do stuff.




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?WnVsdWRvZ00=?=" wrote:

If you select a sheet and look at the Properties, you will find two
properties that name the sheet:
(Name)
Name

When a user changes the sheet name by typing into the sheet Tab, they
are changing the Name property, but not the (Name) property.

Example: When you open a new workbook, Sheet1 will have properties:
(Name) = "Sheet1"
Name ="Sheet1"
When the user renames that sheet to "Revenues" the properties become:
(Name) = "Sheet1"
Name = "Revenues"

You can rename the (Name) property directly in the Properties table
for the sheet, however, I would like to read (and even write) that
property in VBA, but the only methods I can find are for the Name
property. Anybody know how to do this?

Thanks, Mark


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default (Name) Property Under VBA Control

Thanks for the fish and the fishing lesson, KeepItCool.

From there; I have learned that the CodeName can be read, but not written. I only want to read it, so I am pretty happy now.

Brgds,
Mark

"keepITcool" wrote:

the other name is the 'CodeName' of the VBProject

in Tools/References, browse to:
Visual Basic for Applications Extensibility 5.3

checkmark it. press ok.
now open the object browser (F2)
dropdown to VBIDE and you can see all the props that you can program
...

in Excel:
in macro security(2nd tab) you must check
'Allow access to VB object model'

now you're up and running and you can start learning how to do stuff.




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?WnVsdWRvZ00=?=" wrote:

If you select a sheet and look at the Properties, you will find two
properties that name the sheet:
(Name)
Name

When a user changes the sheet name by typing into the sheet Tab, they
are changing the Name property, but not the (Name) property.

Example: When you open a new workbook, Sheet1 will have properties:
(Name) = "Sheet1"
Name ="Sheet1"
When the user renames that sheet to "Revenues" the properties become:
(Name) = "Sheet1"
Name = "Revenues"

You can rename the (Name) property directly in the Properties table
for the sheet, however, I would like to read (and even write) that
property in VBA, but the only methods I can find are for the Name
property. Anybody know how to do this?

Thanks, Mark



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default (Name) Property Under VBA Control

Hello Mark
ActiveWorkbook.VBProject.VBComponents("Sheet1").Na me = "NewName"

HTH

Regards
Pascal

"ZuludogM" a écrit dans le message de
...
If you select a sheet and look at the Properties, you will find two

properties that name the sheet:
(Name)
Name

When a user changes the sheet name by typing into the sheet Tab, they are

changing the Name property, but not the (Name) property.

Example: When you open a new workbook, Sheet1 will have properties:
(Name) = "Sheet1"
Name ="Sheet1"
When the user renames that sheet to "Revenues" the properties become:
(Name) = "Sheet1"
Name = "Revenues"

You can rename the (Name) property directly in the Properties table for

the sheet, however, I would like to read (and even write) that property in
VBA, but the only methods I can find are for the Name property. Anybody
know how to do this?

Thanks, Mark



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default (Name) Property Under VBA Control

Merci Pascal,

Combined with KeepItCool's response, this completes the picture. Your code allows a write to the CodeName and KeepItCool's recommendation gives the read - e.g.:
X = Worksheets("Sheet1").CodeNam

Just as a follow-up. This is useful for managing worksheets where the user can create copies of sheets, rename them and delete them. If the sheet is considered a form, you can use the CodeName code to manage the forms as a collection of objects.

Brgds,
Mark


"papou" wrote:

Hello Mark
ActiveWorkbook.VBProject.VBComponents("Sheet1").Na me = "NewName"

HTH

Regards
Pascal

"ZuludogM" a écrit dans le message de
...
If you select a sheet and look at the Properties, you will find two

properties that name the sheet:
(Name)
Name

When a user changes the sheet name by typing into the sheet Tab, they are

changing the Name property, but not the (Name) property.

Example: When you open a new workbook, Sheet1 will have properties:
(Name) = "Sheet1"
Name ="Sheet1"
When the user renames that sheet to "Revenues" the properties become:
(Name) = "Sheet1"
Name = "Revenues"

You can rename the (Name) property directly in the Properties table for

the sheet, however, I would like to read (and even write) that property in
VBA, but the only methods I can find are for the Name property. Anybody
know how to do this?

Thanks, Mark






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
how do I find out property values for each control object? Bob Allen[_2_] Excel Discussion (Misc queries) 3 July 30th 09 11:23 PM
2007 Form Control/ActiveX Control font difference Nikko963 Excel Discussion (Misc queries) 0 April 15th 09 04:21 PM
changing an activex control property using a macro Sian Excel Discussion (Misc queries) 1 January 11th 08 11:56 AM
Can I control linked cell property value in a copied ActiveX contr Beechbeard Excel Discussion (Misc queries) 0 May 4th 05 10:30 PM
Calendar Control: Can't exit design mode because control can't be created Rone Excel Programming 0 May 24th 04 04:01 PM


All times are GMT +1. The time now is 12:21 PM.

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"