Sorry, that should be PostMessage not SendMessage.
http://support.microsoft.com/?kbid=176391
http://vb-helper.com/howto_terminate_process.html
But you would still need to check if the Excel instance is yours, if running
in Excel/VBA.
NickHK
"NickHK" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This code is to run in Excel VBA ?
> You want to close your own instance ?
>
> Depending on the above GetObject may not be the answer, as you cannot
> stipulate which instance gets returned.
> Maybe use the API FindWindow with "XLMAIN" and SendMesssage with
"WM_CLOSE"
> ?
>
> NickHK
>
> "spIky haIred" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi everyone,
> >
> > I would like to close ALL instances of Excel... I am able to close all
> > workbooks within an instance of Excel but cannot close workbooks in
> > other instances of Excel... Is there a way to scan all open windows? Or
> > even better, to scan all open instances of Excel only?
> >
> > Help would be much appreciated.
> > Thanks in advance,
> > Jason
> >
>
>