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 

Using Excel in an OLEContainer

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





PostPosted: Tue Apr 26, 2005 11:15 am    Post subject: Using Excel in an OLEContainer Reply with quote



Hi, I have an application which opens an excel file in an OLE
container. With a TExcelWorkbook component, I'm using :-

ExcelWorkbook1.ConnectTo(OLEContainer1.OLEObjectInterface as
_Workbook)

to get a reference to the opened workbook. However, my application
uses a number of dll's which reference the opened workbook and refer
to it via a class which stores the current excel application, the
workbook opened and the worksheet. As I cannot refer to the
TExcelApplication, TExcelWorkbook and TExcelWorksheet components from
my dll's, I need the equivalent _Application, _Workbook and _Worksheet
objects. I can use :-

aWorksheet := ExcelWorkbook1.Worksheets[1] as _Worksheet;

to get a _Worksheet object, but I also need a _Workbook and
_Application object. Is their any reliable way of getting the correct
reference to the excel application and workbook?

This area has me confused! There seem to be so many ways to connect
to an excel application, but varying between these methods causes
problems!

Thanks for any help

Sandra
Back to top
Sandra Campbell
Guest





PostPosted: Tue Apr 26, 2005 7:04 pm    Post subject: Re: Using Excel in an OLEContainer Reply with quote



Sorry folks, have worked it out!
Just having problems with different type libraries and different versions of
Delphi!

"Sandra" <sandra.campbell (AT) ent-lib (DOT) co.uk> wrote

Quote:
Hi, I have an application which opens an excel file in an OLE
container. With a TExcelWorkbook component, I'm using :-

ExcelWorkbook1.ConnectTo(OLEContainer1.OLEObjectInterface as
_Workbook)

to get a reference to the opened workbook. However, my application
uses a number of dll's which reference the opened workbook and refer
to it via a class which stores the current excel application, the
workbook opened and the worksheet. As I cannot refer to the
TExcelApplication, TExcelWorkbook and TExcelWorksheet components from
my dll's, I need the equivalent _Application, _Workbook and _Worksheet
objects. I can use :-

aWorksheet := ExcelWorkbook1.Worksheets[1] as _Worksheet;

to get a _Worksheet object, but I also need a _Workbook and
_Application object. Is their any reliable way of getting the correct
reference to the excel application and workbook?

This area has me confused! There seem to be so many ways to connect
to an excel application, but varying between these methods causes
problems!

Thanks for any help

Sandra



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.