Board index » delphi » TOleContainer.OleObject error 'Interface not supported'

TOleContainer.OleObject error 'Interface not supported'

Hi

What have I forgot since all in the newsgroups write that following line
should work on a word document.

Previosly I load the document from a stream.
procedure ChangeWordDocument;
var
    MyWordApp: _Application;
begin
    MyWordApp:= MyOleContainer.OleObject.Application; //error: 'Interface
not supported'

    MyWordApp. do something
end;

regards,
NeBl

 

Re:TOleContainer.OleObject error 'Interface not supported'


<<Nebl:
var
    MyWordApp: _Application;
begin
    MyWordApp:= MyOleContainer.OleObject.Application;
//error: 'Interface not supported'

Quote

Well, that code won't even compile, since
MyOleContainer.OleObject.Application returns a variant -
you have to do this:

  App := IDispatch(OleContainer1.OleObject.Application) as
_Application;

But the Interface not supported error means you haven't
activated the object. Call OleContainer1.DoVerb(ovShow),
orOleContainer1.Run, before you try to access the
oleobject.

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

Re:TOleContainer.OleObject error 'Interface not supported'


Thanks,

I was trying to acces the OleObject property of OleContainer without
activating it.

Is there a way to access the OleObject without showing the OleContainer
context?
I want to generate and print the word document directly, without showing it.
The document is saved in a database, and is saved from the OleObject.
I want to avoid creating temporary files, and only work against the
database.

Regards,
Nenad

"Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in
message news:VA.000006fd.01fd8c8e@cableinet.co.not-this-bit.uk...

Quote
> <<Nebl:
> var
>     MyWordApp: _Application;
> begin
>     MyWordApp:= MyOleContainer.OleObject.Application;
> file://error: 'Interface not supported'

> Well, that code won't even compile, since
> MyOleContainer.OleObject.Application returns a variant -
> you have to do this:

>   App := IDispatch(OleContainer1.OleObject.Application) as
> _Application;

> But the Interface not supported error means you haven't
> activated the object. Call OleContainer1.DoVerb(ovShow),
> orOleContainer1.Run, before you try to access the
> oleobject.

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