Enumerating All Open Excel Documents

Hi
Roman

Working via OLE with more instances opened may be dangerous, but
You can get one instance then close them, and
then get other instance and so on.
Finally you can open all this closed workbooks one by one with
CreateOleObject.
Theoretically.

Miro

"Joe" <z...@gmx.at> pse v diskusnm prspevku
news:3DB3D546.9030502@gmx.at...

Quote
> Hi,

> I need to get a list of all open Excel documents. Currently I do this by
> catching the instance and then enumerating through the Workbooks
> collection. The code (D6) looks like this:

>  > m_iLCID := GetUserDefaultLCID;
>  > Result := GetActiveObject(CLASS_ExcelApplication, nil, Unknown);

>  > OleCheck(Result);
>  > OleCheck(Unknown.QueryInterface(Excel9_TLB._Application, Excel));

>  > for iCnt:=1 to Excel.Application.Workbooks.Count do
>  >    lstDocs.Items.Add(Excel.Application.Workbooks[iCnt].Name);

> Unfortunately this code only brings the names of the documents of the
> first instance of Excel.

> Is there any way to get the Workbooks of other Excel instances?

> Thanks,
> Roman