_CodeName usage

T

Tetsuya Oguma

Hi all,

The following correctly runs through.

Sub test()
Dim WS As Worksheet
Set WS = ActiveSheet
WS.[_CodeName] = "MySheet"
End Sub

But, if I substitute the above three lines with either one
of the following lines, it spitts out the error "Object
Required." Why???

Worksheets("Book").[_CodeName] = "MySheet"
ActiveSheet.[_CodeName] = "MySheet"

Thanks for your time.
 
Top