Board index » delphi » Excel in OLE container Interface not supported

Excel in OLE container Interface not supported

I would like to load an excel file into an OLE container and
access the data in the file.  I have tried this two seperate
ways.

1.  olecontainer.loadfromfile(filename)  This worked great for
showing the file that I had loaded but when I went to access the
information, olevaraiant=olecontainer.oleobject I get a
"interface not supported" error at run time.  Ok so I decided to
try a different approach.
2.  olecontainer.createobject('Excel.Application',false)
olecontainer.oleobject.application.workbooks.open(filename)
This opens the file programmatically but the container won't
show the file because the container object is the appication
and not the workbook.

I don't understand why method 1 doesn't work and method two isn't
exactly what I want because it doesn't show the file in the
container.

Thanks for your help.

 

Re:Excel in OLE container Interface not supported


Quote
"Chris" <Chris.John...@Earthlink.net> wrote:
>1.  olecontainer.loadfromfile(filename)  This worked great for

typo not "loadfromfile" but "createobjectfromfile"

tried using olecontainer.run before the call to oleobject and
this seems to allow the oleobject line to execute.  Seeing the file displayed in the container made me assume the server was running but I guess this is not the case.

Re:Excel in OLE container Interface not supported


<<Chris:
olevaraiant=olecontainer.oleobject I get a
"interface not supported" error at run time.

Quote

You need to activate the olecontainer before you can access
the object, that's all:
  OleContainer.DoVerb(ovShow);

--
Deborah Pate (TeamB) http://delphi-jedi.org

  Use Borland servers; TeamB don't see posts via ISPs
  http://www.borland.com/newsgroups/genl_faqs.html

Other Threads