ACC: Wait Argument in SendKeys May Not Stop Macro ProcessingLast reviewed: August 6, 1997Article ID: Q95449 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. When a macro calls the SendKeys action with the Wait parameter set to Yes, the macro will continue before the program that processed the keystrokes has finished performing the action that it was called to do.
RESOLUTIONTo work around this behavior, have the macro call an Access Basic function or procedure that checks to see if the other application is finished. To correct the situation described above, you can do the following:
Macro Action ------------ RunApp - Start Microsoft Excel SendKeys - Start the macro RunCode - Call a module that continues checking until the file exists TransferSpreadsheet - Import the spreadsheet MORE INFORMATIONFor example, suppose you want to create a macro that will call Microsoft Excel to make a file and then process that file after Microsoft Excel has created it. The Microsoft Access macro calls RunApp to start Microsoft Excel, then calls SendKeys to start a Microsoft Excel macro with the Wait parameter set to Yes. Microsoft Access will wait until the key strokes are processed, then continue if the Microsoft Excel macro has not finished creating the file. Microsoft Access will not wait for Microsoft Excel, and will fail when it tries to use the file. The SendKeys action in Microsoft Access has two arguments: the first argument indicates which keystrokes to send; the second argument causes Microsoft Access to pause until the keystrokes are processed. The description of the Wait argument on page 432 of the Microsoft Access "Language Reference" manual is misleading. If Wait is Yes, Microsoft Access will only wait until the keystrokes are processed. It will not wait until the application that the keystrokes were sent to is finished. For more information about checking for a process to finish, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q99940 TITLE : ACC: How to Wait for a Shelled Process to Finish Keywords : McrArg kbusage Version : 1.0 1.1 2.0 Platform : WINDOWS Hardware : x86 Issue type : kbprb Solution Type : kbworkaround |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |