Oracle Forms and OLE

From: Mark <markg_at_mymail.co.uk>
Date: 18 Jul 2002 08:01:22 -0700
Message-ID: <ddb31653.0207180701.231199dd_at_posting.google.com>



Hi,

I am trying to create a document variable in Word 2000 from Forms 6i. Whne trying to read the document variables value, i get an ORA-305500 error.
Maybe the VBA code isnt being interperated into OLE2 calls correctly by us?

The code is driving me to despair so any good comments welcome. Cheers for help.

Code below.


DECLARE

  • Declare the OLE objects MyApplication OLE2.OBJ_TYPE; MyDocuments OLE2.OBJ_TYPE; MyDocument OLE2.OBJ_TYPE; MySelection OLE2.OBJ_TYPE; MyVariables OLE2.OBJ_TYPE;
  • Declare handle to the OLE argument list args OLE2.LIST_TYPE; var varchar2(100);

 BEGIN            

  • Create the Word.Application object and make Word visible
  • by setting the 'Visible' property to true, by default it is invisible. MyApplication:=OLE2.CREATE_OBJ('Word.Application');

  OLE2.SET_PROPERTY(MyApplication, 'Visible', 'True'); -- Comment this line to hide the application.

  • get a handle on Documents collection MyDocuments:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Documents');
  • Open a new document MyDocument :=OLE2.INVOKE_OBJ(MyDocuments,'Add');

  MyVariables :=OLE2.GET_OBJ_PROPERTY(MyDocument, 'Variables');

  • Create a document variable MyVar and populate with the value 12

message('Adding Document Variable');

  • VBA Code = 'ActiveDocument.Variables.Add Name:="MyVar", Value:="12"

  args:=OLE2.CREATE_ARGLIST;

  OLE2.ADD_ARG(args, 'MyVar');
  OLE2.ADD_ARG(args, '12');
  OLE2.SET_PROPERTY(MyVariables,'Add',args);
  OLE2.DESTROY_ARGLIST(args);

  • Read the document variable and display on Forms message line
  • VBA = ActiveDocument.Variables("MyVar").Value

message('Reading Document Variable');

  var:=OLE2.GET_CHAR_PROPERTY(MyVariables,'Value'); message('Var: ' || var);

END; Received on Thu Jul 18 2002 - 17:01:22 CEST

Original text of this message