Quote:
> I'm having using wscript.getobject to close previously running Office
> applictions. For example, I can use createobject to launch Excel 97, do
> some stuff and close the application.
> However, I want to access a previously opened Excel application and close
> it. I can close the workspace but whenever I try to use the
> Excel.Application, I get the class doesn't support automation error.
> dim obj
> set obj = Wscript.GetObject("c:\temp\test.xls",Excel.Application","obj_")
> obj.Quit
> set obj = nothing
> Sub obj_quit
> Wscript.echo "Closing Excel"
> End sub
> From what I can see, this should work. If I change Excel.Application to
> Excel.workspace, the file closes but the application remains open. Am I
> missing something painfully obvious to the rest of you.
I recently automated a Word application (Should have very similar syntax
to Excel) and used ...
objWord.Application.Quit
to close it, though I opened the application with
Set objWord = WScript.CreateObject("Word.Application")
and opened the desired document with something like ...
objWord.Documents.Open("c:\temp\test.xls")
Don't know whether that makes a difference or whether this is exactly
right for Excel.
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/