Calls method from Word.Application object.
Syntax
CHGVAR |
VAR(&CMD) VALUE('WMETHOD') |
CHGVAR |
VAR(&PARM1) VALUE('Method') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT)) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
Parameters
Parameters |
|
Parm1 |
Full path of the method to call. Example : Documents.Item("Document2").Activate |
Parm2 |
|
Note 1
The WMETHOD command is used to execute methods of the Word VBA language from the AS/400.
The contents of Parm1 respect the syntax used in Visual Basic.
It is possible to use all the constants of Word and Visual Basic Application or the value of the constant itself.
To get an idea of the methods to call, go to Word in "Macro Recording" mode: "Tools" menu - "Macro" - "New Macro".
Do the desired operations on the keyboard and mouse.
Stop the macro recording, and see the code generated by Word: Menu "Tools" - "Macro" - "Macros" - "Edit".
Note 2
There are 2 differences to note between the VB syntax of Word and the LAUNCHER syntax:
1) When selecting an object from a collection, add ".Item" after the name of the collection.
Documents("Document2").Activate
becomes
Documents.Item("Document2").Activate
2) The parameter names (Name: = value) are specific to the VB syntax.
With LAUNCHER, it is necessary to list the
values of each
parameter, in the expected order, separated by ';'
The following statement
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"http://www.easycom-aura.com", SubAddress:="", ScreenTip:="", _
TextToDisplay:="fffff"
becomes
ActiveDocument.Hyperlinks.Add(prop(Selection.Range) ; http://www.easycom-aura.com; "" ; "" ; "Aura")
And so the command is:
LNCCMD CMD(WMETHOD) + PARM1('ActiveDocument.Hyperlinks.Add(prop(Selection.Range);+ "http://www.easycom-aura.com"; ""; ""; "Aura")')
Otherwise, choose to write a macro in Word, which you will call by WEXEMACRO.
Example
This example activates the "Document2" document.
CHGVAR |
VAR(&CMD) VALUE('WMETHOD') |
CHGVAR |
VAR(&PARM1) VALUE('Documents.Item("Document2").Activate') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT)) |