Board index » delphi » OLE variant methods

OLE variant methods

I am using a variant variable for OLE connection with
word 6 and 7 - by using CreateOleObject('word.basic').
It works fine, but there is a problem with calling methods that end
with a '$' char (GetAddInName$(), FileName$() Etc.) because the
comilper refuse to compile those methods.
Does anyone knows how can those methods be called.
Thanks.
ziv.

 

Re:OLE variant methods


Quote
siph...@actcom.co.il wrote:

> I am using a variant variable for OLE connection with
> word 6 and 7 - by using CreateOleObject('word.basic').
> It works fine, but there is a problem with calling methods that end
> with a '$' char (GetAddInName$(), FileName$() Etc.) because the
> comilper refuse to compile those methods.
> Does anyone knows how can those methods be called.
> Thanks.
> ziv.

The trick: forget the '$' char!  Here's a code example using
WordBasic's FileName$() function:

   procedure TForm1.Button1Click(Sender: TObject);
   var
      V: Variant;
   begin
        V := CreateOLEObject('word.basic');
        Button1.Caption := V.FileName;
   end;

Hope this helps,
- Jim Rofkar.

Re:OLE variant methods


Quote
siph...@actcom.co.il wrote:

> I am using a variant variable for OLE connection with
> word 6 and 7 - by using CreateOleObject('word.basic').
> It works fine, but there is a problem with calling methods that end
> with a '$' char (GetAddInName$(), FileName$() Etc.) because the
> comilper refuse to compile those methods.
> Does anyone knows how can those methods be called.

Haven't tried it, but: Quite possible that the trailing type codes are
not actually required. Have you tried calling just plain GetAddInName
or FileName?

--

http://www.midnightbeach.com/jon   Personal Pages
http://www.midnightbeach.com/jon/pubs Programming Publications
http://www.midnightbeach.com/hs             Home School Resource List

Other Threads