Can't access to a Workbook

  • Thread starter Thread starter Jordi
  • Start date Start date
J

Jordi

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.
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.
 
Jordi said:
I've two workbooks opened, but each one in one different Excel's windows,
how can I work with both by code?
I presume you have the two workbooks given a name. You can do the
coding by using the workbooks name followed with a !(eg
workbook1.xls!) and then your method or function (eg
workbook1.xls!function1)
The sentence:

?Workbooks.count

only returns one
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.
This is what microsoft calls creating an excel instance=> this means
that each document has its own instance and/or thread(not sure about
the threading)(java calls it constructors and multithreading). This
means that u actually have 2 objects and that ?workbook.count gives
you the amount of opened workbooks inside that object which is of
course 1.
The solution is:
1. I believe you can set the create instance thing of somewhere in the
options
2. If you do not want to change the options you might give it a try
with
Application.Workbooks.Count
I have tried the second option and it gave me 2(I did not change the
options) for 2 instances of excel.

Hope this helps,
regards,
Kevin Simons
 
Back
Top