Re: Rename Parent work***.name?



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
.


Loading