The information in this article applies to:
SUMMARYIf you want to share the contents of a variable between subroutines, you must declare (dimension) the variable as a global variable. MORE INFORMATION
To define a variable as "global" (to make it accessible in multiple
subroutines), use the Dim command with the shared parameter. The following
sample macro defines variables A and B as global variables.
The above macro displays "2 + 3 is 5" on the status bar at the bottom
of the screen. If you omit the first line of the macro (the Dim
statement), the result is "0 + 0 is 0." Without declaring the A and B
variables as shared, the subroutine called "SumRoutine" does not have
access to the values of A and B.
The following macro displays "2 + 3 is 5" on the status bar without defining the A and B variables as global variables.
Each variable in the comma-delimited parameter list must correspond to
a value that the subroutine being called is prepared to receive.
NOTE: The WordBasic language for Word versions 1.x for Windows allows you to call and pass parameters to routines within the current macro only. It is not possible to call or pass values to subroutines within other macros in versions 1.x of Word for Windows. For more information on passing parameters to another macro, please see the following articles in the Microsoft Knowledge Base: Q94374 Passing Parameters "By Reference" and "By Value" Q94734 CALL Statement Cannot Accept Variable Argument REFERENCES
"Using WordBASIC for Word for Windows and Word for OS/2," by WexTech
Systems Incorporated, pages 122-123
Additional query words: subroutine passing parameter value share sub dim global
Keywords : kbmacro kbusage kbmacroexample winword word6 winword2 word7 word95 |
Last Reviewed: September 30, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |