The information in this article applies to:
SUMMARYWhen you use the Shell command to run another program from a WordBasic macro, Word does not wait for the shelled program to finish running before it processes the rest of the macro. MORE INFORMATION
WordBasic macro processing is considered "asynchronous." This means that
macro commands are executed independently of any timing process, such as
a clock. Macros do not wait for a shelled program to finish before
executing the next command. This can cause problems in your macro,
particularly if the subsequent commands rely on processing performed
by the shelled program.
Word versions 7.0, 7.0aWhen you use Word 7.x with Windows 95 or Windows NT, the following macro will test to see if an application is still running and won't continue on until the test application has finished running:
Word versions 2.0, 6.0The following WordBasic user-defined function, WaitShell(), uses the Windows function GetModuleUsage() to determine if the shelled application has terminated. If the WinExec() function is successful in starting the program, it returns a module handle which identifies the instance of the loaded application. When the application is no longer running, the module handle will be invalid and GetModuleUsage() will return a value of 0. WaitShell() loops until the module handle is invalid, at which point the remaining macro commands are executed.
REFERENCES
"Microsoft Windows Programmer's Reference," volume 2: Functions, pages
404, 979, and 983
Additional query words: 2.0 2.0a-cd winword 7.0 word95 word7 word6 winword2 yield doevents pause
Keywords : kbmacro kbmacroexample |
Last Reviewed: September 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |