PC Review


Reply
Thread Tools Rate Thread

code modules included in sheet count?

 
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      4th Jun 2007
Hi.

I'm working with an Excel file that was the output of Oracle's older version
of ADI (Application Desktop Integrator)... the version of ADI that was a
deskop app itself, and may be running some old Excel things.

There's a code module called "CODE" in it, which shows as a module in the
VBE. But, when asked how many sheets the file has,

Msgbox ActiveWorkbook.Sheets.Count , the module with the CODE is being
included as a sheet. I've proved this by removing the module CODE, and it
then reports 29 sheets.

Originally, I had thought they probably had a sheet with property visible =
xlVeryHidden , but that was not the case.

Is there a property somehwere where I can tell when a module of code is
being included in the sheet count?

Thanks,
Mark
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      4th Jun 2007
I would look at the project window in VBA. The window shows the sheet number
and the sheet name.

"mark" wrote:

> Hi.
>
> I'm working with an Excel file that was the output of Oracle's older version
> of ADI (Application Desktop Integrator)... the version of ADI that was a
> deskop app itself, and may be running some old Excel things.
>
> There's a code module called "CODE" in it, which shows as a module in the
> VBE. But, when asked how many sheets the file has,
>
> Msgbox ActiveWorkbook.Sheets.Count , the module with the CODE is being
> included as a sheet. I've proved this by removing the module CODE, and it
> then reports 29 sheets.
>
> Originally, I had thought they probably had a sheet with property visible =
> xlVeryHidden , but that was not the case.
>
> Is there a property somehwere where I can tell when a module of code is
> being included in the sheet count?
>
> Thanks,
> Mark

 
Reply With Quote
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      4th Jun 2007
> I would look at the project window in VBA. The window shows the sheet
number
> and the sheet name.



In a normal Excel file, I'd agree with you. However, this time, "No it
doesn't."

There are 29 sheets listed in the 'Microsoft Excel Objects' folder (and no,
I didn't miscount).

Yet, the code msgbox activeworkbook.sheets.count reports 30.

There is one object in the 'Modules' folder, whose name is CODE .

If I delete that module, the MsgBox ActiveWorkbook.Sheets.Count reports 29.

So the code module is being reported as a sheet, which was my question.

Is there a way I can tell in the code when that is the case?
 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      4th Jun 2007
Try this.

Worksheet.Type can be the following
xlChart
xlDialogSheet
xlExcel4IntlMacroSheet
xlExcel4MacroSheet
xlWorksheet

Use following code

For Each Ws In Workbooks

Ws.Activate

If ActiveCell.Worksheet.Type = xlWorksheet Then

End If
Next Ws

"mark" wrote:

> Hi.
>
> I'm working with an Excel file that was the output of Oracle's older version
> of ADI (Application Desktop Integrator)... the version of ADI that was a
> deskop app itself, and may be running some old Excel things.
>
> There's a code module called "CODE" in it, which shows as a module in the
> VBE. But, when asked how many sheets the file has,
>
> Msgbox ActiveWorkbook.Sheets.Count , the module with the CODE is being
> included as a sheet. I've proved this by removing the module CODE, and it
> then reports 29 sheets.
>
> Originally, I had thought they probably had a sheet with property visible =
> xlVeryHidden , but that was not the case.
>
> Is there a property somehwere where I can tell when a module of code is
> being included in the sheet count?
>
> Thanks,
> Mark

 
Reply With Quote
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      4th Jun 2007
> If ActiveCell.Worksheet.Type = xlWorksheet Then

Thanks for the suggestion.

In this case, you can't actually get to a cell on the worksheet to use
ActiveCell, though.

I have a plan now that will work, though. Thanks for your suggestion. I'm
still not quite sure what Oracle did, but it doesn't matter any more.

I tried the Type idea, and the module named CODE reports constant -4167, the
same as any other sheet, which must be the constant for xlWorsksheet

My need is to run up through the worksheets performing some code to transfer
some things out to another workbook, but the code needs not to work on this
one oddball sheet.

I've discovered that the workbooks is making a distinction between Sheets
and Worksheets

AtiveWorbook.Sheets(1) is the CODE which I do not want to use, but

ActiveWorkbook.Worksheets(1) is the first visible regular sheet, which I want.

So that will work.

Thanks.
 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      4th Jun 2007
Does this mean you get an error? You can use the error condition to locate
the Oracle sheet. do you get the same number of sheets using sheets and
worksheets?

"mark" wrote:

> > If ActiveCell.Worksheet.Type = xlWorksheet Then

>
> Thanks for the suggestion.
>
> In this case, you can't actually get to a cell on the worksheet to use
> ActiveCell, though.
>
> I have a plan now that will work, though. Thanks for your suggestion. I'm
> still not quite sure what Oracle did, but it doesn't matter any more.
>
> I tried the Type idea, and the module named CODE reports constant -4167, the
> same as any other sheet, which must be the constant for xlWorsksheet
>
> My need is to run up through the worksheets performing some code to transfer
> some things out to another workbook, but the code needs not to work on this
> one oddball sheet.
>
> I've discovered that the workbooks is making a distinction between Sheets
> and Worksheets
>
> AtiveWorbook.Sheets(1) is the CODE which I do not want to use, but
>
> ActiveWorkbook.Worksheets(1) is the first visible regular sheet, which I want.
>
> So that will work.
>
> Thanks.

 
Reply With Quote
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      4th Jun 2007
> Does this mean you get an error?

depends upon the code.

if I were to write:

dim ws as worksheet
set ws = sheets(1)

Yes, it would error.

> You can use the error condition to locate the Oracle sheet.


I could.

> do you get the same number of sheets using sheets and
> worksheets?


No. worksheets.count = 29 ; sheets.count = 30

I saw something a while back about the distinction between a "Worksheet" and
a "Sheet"



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      5th Jun 2007
xl97 added the VBE. xl95 and before used macro sheets.

It sounds like the old program is creating a file using xl95.

I think I did the same thing (but it was a long time ago). I exported the
module, deleted that module and reimported it. (I needed that code.)

mark wrote:
>
> Hi.
>
> I'm working with an Excel file that was the output of Oracle's older version
> of ADI (Application Desktop Integrator)... the version of ADI that was a
> deskop app itself, and may be running some old Excel things.
>
> There's a code module called "CODE" in it, which shows as a module in the
> VBE. But, when asked how many sheets the file has,
>
> Msgbox ActiveWorkbook.Sheets.Count , the module with the CODE is being
> included as a sheet. I've proved this by removing the module CODE, and it
> then reports 29 sheets.
>
> Originally, I had thought they probably had a sheet with property visible =
> xlVeryHidden , but that was not the case.
>
> Is there a property somehwere where I can tell when a module of code is
> being included in the sheet count?
>
> Thanks,
> Mark


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying modules from one sheet to another, in code? Maury Markowitz Microsoft Excel Programming 6 26th Jun 2008 12:05 AM
ACCApp.Modules.count is not giving full count nijujose Microsoft Access Forms 0 6th May 2006 09:47 AM
Find and Replace code in Sheet modules =?Utf-8?B?Sm9u?= Microsoft Excel Programming 11 29th Mar 2005 11:51 PM
When to code in sheet or userform modules and when to use modules Tony James Microsoft Excel Programming 1 16th Dec 2004 10:02 PM
wrong Modules.count ... TNL Microsoft Access VBA Modules 5 31st Jul 2003 01:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 AM.