From: Bin on
I tried it but got the following error and wonder if you can give some help? Many thanks!

>> wbkname = 'whatever';
>> h = actxGetRunningServer('Excel.Application');
>> h.WorkBooks.Item(wbkname).Close;
??? Invoke Error, Dispatch Exception: Invalid index.



"Ilya Rozenfeld" <rozeni.nospam(a)alum.rpi.edu> wrote in message <gn4iak$fm4$1(a)fred.mathworks.com>...
> wbkname = 'whatever';
> h = actxGetRunningServer('Excel.Application');
> h.WorkBooks.Item(wbkname).Close;
>
>
> "KtotheC " <ktothec(a)nospam.com> wrote in message <gn4fgh$rkp$1(a)fred.mathworks.com>...
> > I'm just trying to close an Excel workbook from Matlab. The user may have other Excel workbooks open, so I can't kill Excel completely.
> >
> > I've tried using a 'tasklist' and 'taskkill' approach, but I can't get the 'taskkill' command to only kill one specific workbook, it will nuke all Excel workbooks that are open (even with a filter).
> >
> > Not sure if there is a good way to use the actxserver to accomplish this?
> >
> > Thanks in advance, I appreciate the help!