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

I have an add-in that runs code when any workbook is opened.

During these steps the CodeName of some worksheets in the workbook being
opened are referenced.

If Excel is running before a particular file is opened, and then the
workbook is opened, the code works fine.

However, if Excel is not running, and I double click on the Excel file to
open it, when I get to the step where I reference the CodeName it returns an
empty string.

In trying to debug this I added the following to be able to break into the
code...

x = ws.CodeName
err.raise

When I debug at this breakpoint, I see x = "" and yet when I hover over
ws.CodeName I see the actual worksheet CodeName (it is no longer "").

Does anyone know why this would be happening?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Codename not set

The scenario you describe usually occurs when a new sheet has been added
(manually or programmatically)*and* the VBE is not open. Can you relate that
to what's happening for you. Presumably the VBE is not open before starting
Excel but are you adding a new sheet in the newly opened workbook.

Regards,
Peter T


"BigJimmer" wrote in message
...
I have an add-in that runs code when any workbook is opened.

During these steps the CodeName of some worksheets in the workbook being
opened are referenced.

If Excel is running before a particular file is opened, and then the
workbook is opened, the code works fine.

However, if Excel is not running, and I double click on the Excel file to
open it, when I get to the step where I reference the CodeName it returns
an
empty string.

In trying to debug this I added the following to be able to break into the
code...

x = ws.CodeName
err.raise

When I debug at this breakpoint, I see x = "" and yet when I hover over
ws.CodeName I see the actual worksheet CodeName (it is no longer "").

Does anyone know why this would be happening?

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Codename not set

VBE is closed, but no new sheets are being added to the workbook.

I'm looping through each sheet in the workbook being opened, and if certain
information is found within the formulas on a sheet, then I need to perform
other steps. This is when I try to access the worksheet code name of the
sheet that is current in the loop and get the problem.


"Peter T" wrote:

The scenario you describe usually occurs when a new sheet has been added
(manually or programmatically)*and* the VBE is not open. Can you relate that
to what's happening for you. Presumably the VBE is not open before starting
Excel but are you adding a new sheet in the newly opened workbook.

Regards,
Peter T


"BigJimmer" wrote in message
...
I have an add-in that runs code when any workbook is opened.

During these steps the CodeName of some worksheets in the workbook being
opened are referenced.

If Excel is running before a particular file is opened, and then the
workbook is opened, the code works fine.

However, if Excel is not running, and I double click on the Excel file to
open it, when I get to the step where I reference the CodeName it returns
an
empty string.

In trying to debug this I added the following to be able to break into the
code...

x = ws.CodeName
err.raise

When I debug at this breakpoint, I see x = "" and yet when I hover over
ws.CodeName I see the actual worksheet CodeName (it is no longer "").

Does anyone know why this would be happening?

Thanks!




Reply
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
Using a sheet's 'Codename' Michelle Excel Programming 1 July 31st 09 07:21 AM
Codename conflict Jim Rech Excel Programming 0 January 22nd 07 04:20 PM
Changing Codename in VBA Dennis Excel Programming 3 November 17th 06 07:04 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 11:05 PM.

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

About Us

"It's about Microsoft Excel"