Closing MS-Word via OLE in Forms6
Date: Fri, 19 Jul 2002 07:38:23 -0400
Message-ID: <3D37FA2F.5010807_at_yahoo.com>
Hello,
Users have requested a spell check function in my the form that I am
developping (in Forms6). I have found some procedure that used the OLE2
package to call MS-Word and initiate spell check (at least up to version
Word2000. MS changed the menu heading, basterds). Now after the spell
check, I will move the string back to the Oracle form and than MS-Word
should close itself without asking the user for Saving the document.
Is there some way I can add this parameter to the INVOKE-command? Or can
I add another line infront of this to disable that nagging question of
saving the document.
-- Close MS-Word application
OLE2.INVOKE(application, 'FileExit');
Thanks,
Piet
PROCEDURE call_Word (p_string IN VARCHAR2) IS
-- Declare the OLE object
application OLE2.OBJ_TYPE;
-- Declare handle to the OLE argument list
args OLE2.LIST_TYPE;
-- Declare a temporary local variable for returned text
sel_text VARCHAR2(4000);
BEGIN
-- Start WordBasic and make Word visible (nothing more)
application := OLE2.CREATE_OBJ('Word.Basic');
OLE2.INVOKE(application, 'Appshow');
- Create a temporary document to do spell check in OLE2.INVOKE(application, 'FileNew');
- Insert the text of a TEXT_FIELD into the temporary document args := OLE2.CREATE_ARGLIST; OLE2.ADD_ARG(args, p_string); OLE2.INVOKE(application, 'Insert', args); OLE2.DESTROY_ARGLIST(args);
- Invoke the Spell Checker OLE2.INVOKE(application, 'ToolsSpelling'); -- Works not for Word2002
- Return corrected text to Oracle Forms OLE2.INVOKE(application, 'EditSelectAll'); sel_text := OLE2.GET_CHAR_PROPERTY(application, 'Selection');
- Close MS-Word application OLE2.INVOKE(application, 'FileExit');
- Release the OLE object OLE2.RELEASE_OBJ(application);
- The text brought back contains an extraneous control character
- (a paragraph marker) so get rid of it sel_text := SUBSTR(sel_text, 1, (LENGTH(sel_text)-1)); :reports.detail := sel_text; END;