I have a form in which there are multiple listbox controls. On some of the controls I wanted to allow the user to change the order of selected items. To do this I didn't want extra buttons so I'm trying to use the KeyDown event.
In order for the user to move a selection up or down the user was to use the Up/Down arrow keys in conjunction with the shift key. Hence I have to use the KeyDown.
The following is the KeyDown code:
Private Sub lboUpdWkStation_SelOps_KeyDown(ByVal KeyCode As MSForms.ReturnIntege
r, ByVal Shift As Integer)
'
' Me.txtUpdWkStation_UpdateName = ""
' Me.txtUpdWkStation_UpdateName = "Shift : " & Shift & " --- KeyCode" & K
eyCode
'
'' Step 1 : Holding the shift key indicates user wants to change the order of
selections
' If Shift = 1 Then
' If KeyCode = 38 Then Call MoveEntry(Me.lboUpdWkStation_SelOps, "UP")
' If KeyCode = 40 Then Call MoveEntry(Me.lboUpdWkStation_SelOps, "DOWN")
' End If
'
'' Step 2 : Ctrl - A = select all ; Ctrl -U = deselect all
' If Shift = 2 Then
' If KeyCode = 65 Then Call SelectAllItems(Me.lboUpdWkStation_SelOps, True)
' If KeyCode = 85 Then Call SelectAllItems(Me.lboUpdWkStation_SelOps, False)
' End If
'
End Sub
The problem:
I've found that when the user opens, to include me, the project and at the desired point tries to indicate he/she wants to adjust the order of the entries the form is not registering the KeyDown events. I've also noticed that the Up/Down arrows are not moving the selection indicator either.
Now if I go into code to either place a MsgBox or step through the code it works as it should.
The question is:
Is there something going on in which events are not automatically triggered?
The form in question had 200 + controls on it. It's been suggested, on another Excel / VBA Programming board that I had run into the upper limit for module size. I've be removing controls to seperate forms and all code works as planned.
So keep in mind that there is a limit to module size in VBA.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks