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 

How to set excelapplication.activeworkbook by program ?

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





PostPosted: Tue Sep 07, 2004 1:50 am    Post subject: How to set excelapplication.activeworkbook by program ? Reply with quote




Hello:

I want to load several excel files at the same time and use tabcontrol to switch activeworkbook, but the activeworkbook property is readonly...

I have tried and found that I can do this with just open the file again (i.e excelapp.workbooks.open(....)) and the workbooks.count wouldn't grow up, but this take too much time because the system seems to read the file again.

Please help me how to set the activeworkbook by program ?

Environment: D7
texcelapplication property:
autoconnect : true
autoquit : true
connectkind : ckRunningOrNew

Any suggestion would be appreciated and thanks a lot in advance.

Carl
Back to top
Oliver Townshend
Guest





PostPosted: Tue Sep 07, 2004 3:21 am    Post subject: Re: How to set excelapplication.activeworkbook by program ? Reply with quote



Quote:
I want to load several excel files at the same time and use tabcontrol
to switch activeworkbook, but the activeworkbook property is readonly...


In excel you select the relevant tab, eg:

Sheet1.Select (or whatever you have called the worksheet)

Oliver Townshend



Back to top
Carl Yang
Guest





PostPosted: Wed Sep 08, 2004 1:43 am    Post subject: Re: How to set excelapplication.activeworkbook by program ? Reply with quote




Quote:
In excel you select the relevant tab, eg:

Sheet1.Select (or whatever you have called the worksheet)


Hello:

Thanks for your response.
The select works for sheet selection.
But I try to select one excel workbook from workbooks collection, and the _workbook type not support select method..

I also find that there is a type TexcelOleobject with select method but I can't find how to convert _workbook to _oleobject
or Texceloleobject.

Please help me: how to select one workbook from workbooks collection and set it as activeworkbook ?

Thank you very much !

Carl Yang




Back to top
Carl Yang
Guest





PostPosted: Wed Sep 08, 2004 2:21 am    Post subject: Re: How to set excelapplication.activeworkbook by program ? Reply with quote


Hello:

I have found what I want on MSDN online:

just set workbooks[index].active(lcid)

so simple... :)

Thanks for everyone.

Carl
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.