Run-time Error Using SendKeys to Send Right Brace Character

ID: Q114343


The information in this article applies to:
  • Microsoft Visual Basic programming system, Applications Edition, version 1.0
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Project for Windows, version 4.0


SYMPTOMS

If you use the SendKeys command to send the right brace character "}"in a Visual Basic, Applications Edition procedure, you receive the following error message:

Run-time error '5':

Invalid procedure call
Note that this problem does not occur if you use the SendKeys command to send the left brace character "{".


WORKAROUNDS

To work around this problem in Microsoft Excel, you can use the SendKeys method as in the following example:


   Application.SendKeys "{}}" 
-or-

   Application.SendKeys "{" & chr$(125) & "}" 
Note that you cannot use the SendKeys method (Application.SendKeys) in Microsoft Project.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The error message described above appears if you use either of the following methods in a Visual Basic, Applicaitons Edition procedure to send this character:


   SendKeys "{}}" 
-or-

   SendKeys "{" & chr$(125) & "}" 
NOTE: The following equivalent code works in Visual Basic for Windows Programming System, version 3.0.

   Sub Form_Click ()
      SendKeys "{}}"
   End Sub 


REFERENCES

For more information about the SendKeys Statement or the SendKeys Method, choose the Search button in the Visual Basic Reference and type:

SendKeys

Additional query words:

Keywords :
Version : :1.0; WINDOWS:4.0,5.0,5.0c
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: October 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.