View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Setting the CodeName of a new worksheet in the VBE Editor

Worksheets.Add
With ActiveSheet
.Parent.VBProject.VBComponents(.CodeName) _
.Properties("_CodeName") = "wsNewSheet"
End With


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Philip" wrote in message
...
Hi,

When I programatically add a new worksheet in VBA, is there a way to
programatically set the CodeName property ...

So instead of showing as Sheet1 in the VB Editor 'Project Explorer', the
new
sheet shows as what I want it to be.

This is for Excel 2003

thanks for any help

Philip