Re: Rename Parent work***.name?
- From: Dave Peterson <petersod@xxxxxxxxxxxxxxxx>
- Date: Thu, 15 Nov 2007 14:33:33 -0600
The parent of the work*** is the workbook.
You can't change that workbook's name--well, except by saving it with the new
name.
It kind of looks like you're trying to change the codename of a work***.
If that's true, you can use code like:
ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "NewCodeName"
where sheet1 is the code name
or
dim wks as work***
set wks = active***
ThisWorkbook.VBProject.VBComponents(wks.codename).Name = "NewCodeName"
'or
ThisWorkbook.VBProject.VBComponents(wks.CodeName) _
.Properties("_CodeName").Value = "NewCodeName2"
But you'll have to toggle a security setting
tools|macro|security|trusted publisher tab
check "trust access to Visual basic project"
(added in xl2002 IIRC--who knows where it's hiding in xl2007 <vbg>.)
Rick S. wrote:
I know how to rename a worksheet in VBA, ***Sheets(i).Name = "Sheet" & i"***,
but I can not seem to rename the parent name.
Using ***Sheets(i).Parent.Name*** errors out. (invalid assignment?)
If I create a work*** it counts and adds to the parent name so I could end
up with Sheet15(Sheet2) what I want is Sheet2(Sheet2).
Thank you in advance.
--
Regards
Rick
XP Pro
Office 2007
--
Dave Peterson
.
- Follow-Ups:
- Re: Rename Parent work***.name?
- From: Rick S.
- Re: Rename Parent work***.name?
- Prev by Date: Re: Printing multiple embedded Word Documents
- Next by Date: Re: Rename Parent work***.name?
- Previous by thread: Re: Userform Question
- Next by thread: Re: Rename Parent work***.name?
- Index(es):
Loading