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 

Reference to Excel file

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





PostPosted: Mon Sep 12, 2005 11:57 am    Post subject: Reference to Excel file Reply with quote



Hi,

I need to get the reference of a given Excel file using OLE. If I use
GetActiveOLEObject, it gives me the reference to the active excel file that
is open.
But I need to open a particular excel file (file name given by the
application). I use OLE to read/write from/to excel.
Please Help!

Sorry I have posted the message earlier by mistake in delphi.general
newsgroup also.

Thanks,
Dorothy


Back to top
Mike Shkolnik
Guest





PostPosted: Mon Sep 12, 2005 3:11 pm    Post subject: Re: Reference to Excel file Reply with quote



Use the next code:

try
xls := GetActiveOleObject('Excel.Application');
except
xls := CreateOleObject('Excel.Application');
end;
xlw := xls.WorkBooks.Open(yourFileName)
....

--
With best regards, Mike Shkolnik
EMail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
http://www.scalabium.com

"Dorothy" <dorothysunitha (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I need to get the reference of a given Excel file using OLE. If I use
GetActiveOLEObject, it gives me the reference to the active excel file
that
is open.
But I need to open a particular excel file (file name given by the
application). I use OLE to read/write from/to excel.
Please Help!

Sorry I have posted the message earlier by mistake in delphi.general
newsgroup also.

Thanks,
Dorothy





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.