Ticket #134: WordByRefTest.au3

File WordByRefTest.au3, 727 bytes (added by Valik, 12 years ago)
Line 
1; Example by big daddy
2
3; Before running this:
4;    1. Create a Word Document
5;    2. Press Alt-F11
6;    3. Double Click "ThisDocument"
7;    4. Paste the following macro
8;    5. Saveas "ByRef.doc"
9
10; Comment from big daddy:
11; I would have expected the following to write "After" to the console, but instead it still has the value of "Before".
12
13#include <Word.au3>
14
15$vArg = "Before"
16$sFilePath = @ScriptDir & "\ByRef.doc"
17
18$oWordApp = _WordCreate($sFilePath, 0, 0)
19__WordMacroRun($oWordApp, "MacroTestByRef", $vArg)
20_WordQuit($oWordApp, 0)
21ConsoleWrite($vArg & @CR)
22
23Func __WordMacroRun(ByRef $o_object, $s_MacroName, ByRef $v_Arg1)
24    $o_object.Run($s_MacroName, $v_Arg1)
25EndFunc   ;==>__WordMacroRun