Try a script like this (passing it a workbook name):
Dim XL
on error resume next
set XL = GetObject(,"Excel.Application")
If XL is Nothing Then Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open Wscript.Arguments(0)
XL.Visible = True
Path? No, very 80's question<g>. GetObject looks to the registry to find
where an application is.
--
Jim Rech
Excel MVP
| > You might try a script like this:
| >
| > Dim XL
| > on error resume next
| > set XL = GetObject(,"Excel.Application")
| > If XL is Nothing Then Set XL = CreateObject("Excel.Application")
| > XL.Workbooks.Open "c:\Book1.xls"
| > XL.Visible = True
| >
| > Create a VBS file with this in it and you can run it from the
commandline or
| > Start->Run.
| >
|
| This looks like it will solve my problem! Two questions:
|
| 1. Does Excel need to be in my path in order for this to work.
| 2. I don't know VB (only a little VBA). How dow I pass parameters into
| the script so I can say "myscript.vbs foo.xls"?
|
| Thanks!
|
| Bura
| > --
| > Jim Rech
| > Excel MVP
| > | > > Hi,
| > >
| > > Suppose I have an instance of Excel running and I want to open the
| > > file "foo.xls" into that instance from command line. If I give the
| > > command "excel foo.xls" it will open a new instance of Excel, which is
| > > OK but would cause great overhead for me.
| > >
| > >
| > > Thanks!
| > >
| > > Bura