LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Codename not set

I use the worksheet codename extensively throughout my add-ins. However at
times I get errors because the codemame is not initialized at the point in
the code where it is being referenced.

For example, if I add something like this to my code....

sub Test (ws as Worksheet)

dim str as string

str = ws.CodeName

if str = "" then
debug.print "Missing Codename"
else
debug.print "CodeName = " & ws.Codename
end sub

I sometimes will get "Missing Codename", and other times (for the same
worksheet), it returns the code name. If I try stepping through the code, it
will always return a value for CodeName.

I have narrowed the occurrence of the problem down to being when the
worksheet uses the default code name (Sheet#) and the code is run either
during the workbook open event, or is run using a worksheet that was just
added to the workbook.

Any ideas on how to resolve this problem?

This happens in both Exccel 2000 and 2003.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Codename not set BigJimmer Excel Programming 2 October 6th 09 06:19 PM
Using a sheet's 'Codename' Michelle Excel Programming 1 July 31st 09 07:21 AM
Codename passing Nigel[_2_] Excel Programming 3 December 10th 07 12:50 PM
VBA codename and codeprotection CoCo Excel Programming 0 August 10th 06 04:46 AM
codename help Gary Keramidas Excel Programming 14 October 31st 05 12:32 AM


All times are GMT +1. The time now is 03:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"