Здравствуйте, shorj, Вы писали:
S> ExApp := GetActiveOleObject('Excel.Application');
S>далее, по некоторым (неважно, каким именно .}) признакам определяем, что эта копия excel нам не подходит. в памяти загружено несколько экселей. как получить ссылку на следующий экземпляр в памяти?
См. MSDN HOWTO: Attach to a Running Instance of an Office Application
Q238975
Theoretically, you can iterate the ROT for each individual instance, but Office applications do not register themselves if another instance is already in the ROT because the moniker for itself is always the same, and cannot be distinguished. This means that you cannot attach to any instance except for the first. However, because Office applications also register their documents in the ROT, you can successfully attach to other instances by iterating the ROT looking for a specific document, attaching to this document, and then getting the Application object from this document. For a code example of iterating the ROT and looking for a document name, click the article number below to view the article in the Microsoft Knowledge Base:
Q190985 HOWTO: Get IDispatch of an Excel or Word Document from an OCX