carolinaof
Programmer
I am trying to edit a word document replacing bookmarks. The following code is opening the document, wich is an embedded databease item OLE, but the gotos and inserts are not working. In my tests with an independently executing word application, the inserts work, but the gotos to the bookmarks don't. What am I doing wrong?
DECLARE
application OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
BEGIN
FORMS_OLE.ACTIVATE_SERVER('DOC');
application:=OLE2.CREATE_OBJ('Word.Basic');
FORMS_OLE.EXEC_VERB('DOC',1);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'EmployeeName');
OLE2.INVOKE(application, 'EditGoto', args);
OLE2.DESTROY_ARGLIST(args);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'Carol Johnson');
OLE2.INVOKE(application, 'Insert', args);
OLE2.DESTROY_ARGLIST(args);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'C:\TEMP\LETTER1.DOC');
OLE2.INVOKE(application, 'FileSaveAs', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.INVOKE(application, 'EditUndo');
OLE2.INVOKE(application, 'EditUndo');
OLE2.RELEASE_OBJ(application);
FORMS_OLE.CLOSE_SERVER('DOC');
END;
DECLARE
application OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
BEGIN
FORMS_OLE.ACTIVATE_SERVER('DOC');
application:=OLE2.CREATE_OBJ('Word.Basic');
FORMS_OLE.EXEC_VERB('DOC',1);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'EmployeeName');
OLE2.INVOKE(application, 'EditGoto', args);
OLE2.DESTROY_ARGLIST(args);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'Carol Johnson');
OLE2.INVOKE(application, 'Insert', args);
OLE2.DESTROY_ARGLIST(args);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'C:\TEMP\LETTER1.DOC');
OLE2.INVOKE(application, 'FileSaveAs', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.INVOKE(application, 'EditUndo');
OLE2.INVOKE(application, 'EditUndo');
OLE2.RELEASE_OBJ(application);
FORMS_OLE.CLOSE_SERVER('DOC');
END;