Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.vba
|
|||
|
|||
Calling a worksheet via a codename
Hi!
I have a xla and a xlt. In a xla macro, i need to access a sheet of an instance of the template with a specific codename. The following code returns an error: ActiveWorkbook.xlsTheSheet even: ActiveWorkbook.worksheets(xlsTheSheet) What's the good way to acces the xlsTheSheet? Thanks, Thierry Paradis. |
#2
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.vba
|
|||
|
|||
Calling a worksheet via a codename
just use xlThesheet
it only works with the activeworkbook. demo'd from the immediate window: ? xlsThesheet.Name Sheet1 -- Regards, Tom Ogilvy "Thierry Paradis" wrote in message ... Hi! I have a xla and a xlt. In a xla macro, i need to access a sheet of an instance of the template with a specific codename. The following code returns an error: ActiveWorkbook.xlsTheSheet even: ActiveWorkbook.worksheets(xlsTheSheet) What's the good way to acces the xlsTheSheet? Thanks, Thierry Paradis. |
#3
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.vba
|
|||
|
|||
Calling a worksheet via a codename
Another way might be to get a reference to the sheet using the codename,
then use that reference Sub abc() Dim sh As Worksheet, s As String s = ActiveWorkbook.VBProject.VBComponents( _ "xlsTheSheet").Properties("name").Value Set sh = Worksheets(s) msgbox sh.Name End Sub -- Regards, Tom Ogilvy "Thierry Paradis" wrote in message ... Hi! I have a xla and a xlt. In a xla macro, i need to access a sheet of an instance of the template with a specific codename. The following code returns an error: ActiveWorkbook.xlsTheSheet even: ActiveWorkbook.worksheets(xlsTheSheet) What's the good way to acces the xlsTheSheet? Thanks, Thierry Paradis. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changeing codename of worksheet via VBComponents collection | Excel Programming | |||
Referencing worksheet CODENAME in a chart object. | Excel Discussion (Misc queries) | |||
Some worksheet returns NULL for CodeName property. Why? | Excel Programming | |||
Using Worksheet Codename to Determine Worksheet Existence | Excel Programming | |||
Worksheet codename | Excel Programming |