The information in this article applies to:
SUMMARYIn Microsoft Word for Windows, you can call macro subroutines and functions that are defined in one macro from within another macro. You can use this technique to create libraries of common routines and avoid having to copy or rewrite procedures you use often. MORE INFORMATIONWord97For more information about calling macro subroutines and functions, while in the Visual Basic for Applications Editor click the Office Assistant, type "Call," click Search, and then click to view "Call Statement."All other versions of Word listed aboveSubroutine:To call a macro subroutine from within another macro, use the following syntax: MacroName.RoutineNameMacroName is the name of the macro containing the routine, and RoutineName is the name of the routine you want to use. The template containing the library routine, or a document to which the template is attached, must be open when the routine is called. Routines stored in the NORMAL.DOT template are always available. For example, if you create a macro called Lib1, which contains the subroutine MyBeep, you can call MyBeep from other macros. The following is the subroutine MyBeep:
The following example illustrates how you can use the MyBeep subroutine in
a macro called SwitchToDotPath:
Function:
The syntax for using a function that you defined in another macro is similar to that used for calling a subroutine. For example, if you define a function called MyDateTime$(time$) in the Lib1 macro library, you could call that function from another macro, titled CheckDateTime. The following is the MyDateTime$(time$) function:
You can call the MyDateTime$(time$) function from the following macro,
called CheckDateTime:
REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, pages 58-59 Additional query words: 1.x 1.0 1.1 1.1a 2.0 7.0 word95 winword macword 6.0.1 word7 word6 winword2 6.0 word8 word97 8.0
Keywords : kbmacro macword98 winword ntword macword word6 winword2 word7 |
Last Reviewed: September 30, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |