Determine number of open excel files

  • Thread starter Thread starter gw.boswell
  • Start date Start date
G

gw.boswell

I have a macro in which I need to open a specific Excel file.
Unfortunately with the code below although I can open the file, whether
it is visible and can be accessed depends on how many other Excel files
are open. How can I determine how many excel files are already open

Set xlAppEval = GetObject(, "Excel.Application")

Set Model = GetObject("c:\EVAL.xls")

xlAppEval.Application.Visible = True
xlAppEval.Parent.Windows(3).Visible = True <== only works if 2 excel
files are already open.


Alternatively, is there a better way to open the specified as an OLE
object?

TIA,
Garry
 
if you have one open then you've got too many

excel is a disease run away while you still can
 
Garry,
Dim lngX as Long
lngX = xlAppEval.Workbooks.Count
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


<[email protected]>
wrote in message
I have a macro in which I need to open a specific Excel file.
Unfortunately with the code below although I can open the file, whether
it is visible and can be accessed depends on how many other Excel files
are open. How can I determine how many excel files are already open

Set xlAppEval = GetObject(, "Excel.Application")
Set Model = GetObject("c:\EVAL.xls")

xlAppEval.Application.Visible = True
xlAppEval.Parent.Windows(3).Visible = True <== only works if 2 excel
files are already open.
Alternatively, is there a better way to open the specified as an OLE
object?

TIA,
Garry
 
Jim,
You auggestion worked perfectly (which I'm sure you knew it would).
Thanks you very much. That makes my life a lot easier.
Garry
 
Jim,
You suggestion worked perfectly (which I'm sure you knew it would).
Thanks you very much. That makes my life a lot easier.
Garry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top