ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I can't see a Workbook in WorkBooks.Count (https://www.excelbanter.com/excel-programming/282263-i-cant-see-workbook-workbooks-count.html)

Jordi

I can't see a Workbook in WorkBooks.Count
 
I've two workbooks opened, but each one in one different Excel's windows,
how can I work with both by code?

The sentence:

?Workbooks.count

only returns one.



Bernie Deitrick[_2_]

I can't see a Workbook in WorkBooks.Count
 
Jordi,

If Workbooks.Count returns 1, then you have only 1 workbook open, with
mutliple windows of that one workbook. Try using

Debug.Print ActiveWorkbook.Windows.Count

to confirm.

Then you really aren't working with different workbooks - just
different views of the same workbook.

HTH,
Bernie
MS Excel MVP

"Jordi" wrote in message
...
I've two workbooks opened, but each one in one different Excel's

windows,
how can I work with both by code?

The sentence:

?Workbooks.count

only returns one.





Jordi

I can't see a Workbook in WorkBooks.Count
 
Thank you for your attention, but isn't the case.
I open one workbook, and then another aplications creates a new workbook, in
the Window menu I only see the current window in each Excel, but I have two
workbooks opened in two Excel.

I'm using Excel 2002.

"Bernie Deitrick" escribió en el mensaje
...
Jordi,

If Workbooks.Count returns 1, then you have only 1 workbook open, with
mutliple windows of that one workbook. Try using

Debug.Print ActiveWorkbook.Windows.Count

to confirm.

Then you really aren't working with different workbooks - just
different views of the same workbook.

HTH,
Bernie
MS Excel MVP

"Jordi" wrote in message
...
I've two workbooks opened, but each one in one different Excel's

windows,
how can I work with both by code?

The sentence:

?Workbooks.count

only returns one.







Bernie Deitrick[_2_]

I can't see a Workbook in WorkBooks.Count
 
Jordi,

Why are you using two instances rather than a single instance?

In your other application, you can find the current active Excel by
using GetObject:

Public xlApp As Excel.Application
On Error Resume Next
Set xlApp = GetObject("Excel.Application")
If xlApp = Nothing Then
Set xlApp = CreateObject("Excel.Application")
End If

You will need to have a reference set to the Excel object library in
your other application.

Then, you should be able to find all open workbooks, since you will
only have one Excel.

HTH,
Bernie
MS Excel MVP

"Jordi" wrote in message
...
Thank you for your attention, but isn't the case.
I open one workbook, and then another aplications creates a new

workbook, in
the Window menu I only see the current window in each Excel, but I

have two
workbooks opened in two Excel.

I'm using Excel 2002.






All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com