The information in this article applies to:
SYMPTOMS
When you use Visual Basic for applications to enter text into the active
cell, and you use the SendKeys command to set the active cell to edit mode,
the macro will fail when it is run from the shortcut key assigned to the
macro.
CAUSEThis problem occurs when you invoke the macro by using the shortcut key CTRL+<key> (where <key> is the key assigned to the macro>). The SendKeys statement is run immediately in this macro. Because it is extremely unlikely that you will be able to release the CTRL key before the SendKeys is executed, a key combination of CTRL+F2 is sent to Microsoft Excel, which brings up the information window. WORKAROUND
To avoid this problem, add a wait period of one second before the SendKeys
command is executed. This allows the macro to execute properly.
Sample Macro
NOTE: When you run this macro, you must release the CTRL key before the one
second delay is over or the Information Window will be displayed.
MORE INFORMATIONThe Wait method pauses a macro that is running until a specified time is reached. The Wait method suspends all Microsoft Excel activity and may prevent you from performing other operations on your computer. Background processes, such as printing and recalculation, are continued. Additional query words: Send Keys
Keywords : kbprg xlwin |
Last Reviewed: October 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |