Hello
I am trying to grasp the concept of KeyPress. It seems simple. I understand all code examples I've seen. Yet I have difficulty getting even the most basic version working. I keep getting the 'procedure declaration does not match description of event or procedure having the same name'. Can someonte tell me what I'm doing wrong? Any tips greatly appreciated
I tried the example from http://msdn.microsoft.com/en-us/library/aa211401%28v=office.11%29.aspx
I created a form with just one textbox called ShipRegion. The only code behind the form is the code from the MSDN site:
Private Sub ShipRegion_KeyPress(KeyAscii As Integer)
Dim strCharacter As String
' Convert ANSI value to character string.
strCharacter = Chr(KeyAscii)
' Convert character to upper case, then to ANSI value.
KeyAscii = Asc(UCase(strCharacter))
End Sub
Running this results in the error message as mentioned. I can´t see why (fairly new to VBA, obviously ) So, my question is not about what this sub is supposed to be doing, but how I can get it to work.
Thank you
I am trying to grasp the concept of KeyPress. It seems simple. I understand all code examples I've seen. Yet I have difficulty getting even the most basic version working. I keep getting the 'procedure declaration does not match description of event or procedure having the same name'. Can someonte tell me what I'm doing wrong? Any tips greatly appreciated
I tried the example from http://msdn.microsoft.com/en-us/library/aa211401%28v=office.11%29.aspx
I created a form with just one textbox called ShipRegion. The only code behind the form is the code from the MSDN site:
Private Sub ShipRegion_KeyPress(KeyAscii As Integer)
Dim strCharacter As String
' Convert ANSI value to character string.
strCharacter = Chr(KeyAscii)
' Convert character to upper case, then to ANSI value.
KeyAscii = Asc(UCase(strCharacter))
End Sub
Running this results in the error message as mentioned. I can´t see why (fairly new to VBA, obviously ) So, my question is not about what this sub is supposed to be doing, but how I can get it to work.
Thank you