BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GetOleActiveObject - two Excels running

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Uncle Potato
Guest





PostPosted: Fri Aug 05, 2005 9:31 am    Post subject: GetOleActiveObject - two Excels running Reply with quote



If I have two excel opening two files, how do I know which one I am
getting with GetOleActiveObject ??

Back to top
Nikolay
Guest





PostPosted: Sun Aug 07, 2005 7:51 am    Post subject: Re: GetOleActiveObject - two Excels running Reply with quote




Hi this is a big discussion. I will share how I do it with MS WORD and PowerPoint because I am making automation progrmas for Word and PPoint. I think expecially the way I do it with Word will apply to Excel.

1. Just make a template with a startup macro AUTOOPEN or AUTOEXEC or whatever.

2. Make a DELPHI DLL wich will have an exported function that may be called form the startup template.

3. in the automacro autoopen or autoexec call that function with a byval parameter excel.application for example

startin excel.application

you also should declare that as an external function

public declare sub startin lib "mydll.dll" (byval app as application)

4. In the dll you do the following

procedure startin(xl: idispatch);
begin
xapp:=xl as texcelapplication;
end;

You get the texcelapplication class from the server component group of delphi. This method is not that relible because I have
discovered it, meening never read a discription of it, but still
it works and does the job I want.

Nikolay

Uncle Potato <Potato (AT) aelhk (DOT) com> wrote:
Quote:
If I have two excel opening two files, how do I know which one I am
getting with GetOleActiveObject ??



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.