Run-time Error Using SendKeys to Send Right Brace Character

Last reviewed: July 29, 1997
Article 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
Keywords          : kbcode kbprg
Version           : 1.00 4.00 5.00
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : Info_Provided


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.