Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using a sheet's 'Codename' | Excel Programming | |||
Codename conflict | Excel Programming | |||
Changing Codename in VBA | Excel Programming | |||
VBA codename and codeprotection | Excel Programming | |||
codename help | Excel Programming |