I pass the Keycode variable into a sub that changes its value from 107 to zero. Yet it returns as 107 - it should be returning as zero.
Private Sub tabBackWardsOnPlusSign(ByRef KeyCode As Integer)
If KeyCode = 107 Then 'plus sign
KeyCode = 0 'supress the plus sign
SendKeys "+{TAB}" 'tab backwards
End If
End Sub
Why isn't ByRef working?
This code is pretty simple. I just want the user to be able to tab backwards from textbox to textbox when he types the plus sign (which is Keycode 107).
Private Sub txtShortNo_KeyDown(KeyCode As Integer, Shift As Integer)
tabBackWardsOnPlusSign (KeyCode)
End Sub
Private Sub tabBackWardsOnPlusSign(ByRef KeyCode As Integer)
If KeyCode = 107 Then 'plus sign
KeyCode = 0 'supress the plus sign
SendKeys "+{TAB}" 'tab backwards
End If
End Sub
Why isn't ByRef working?
This code is pretty simple. I just want the user to be able to tab backwards from textbox to textbox when he types the plus sign (which is Keycode 107).
Private Sub txtShortNo_KeyDown(KeyCode As Integer, Shift As Integer)
tabBackWardsOnPlusSign (KeyCode)
End Sub