Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello, What I want to do is... Using a vb comboBox the user will enter a string and hit return. Once return has been hit this will make a call to a db and search o the string entered, the results will populate the combobox. How do I detect when the return key has been pressed, in the comboBox? Thank -- cmpcwil ----------------------------------------------------------------------- cmpcwil2's Profile: http://www.excelforum.com/member.php...fo&userid=3341 View this thread: http://www.excelforum.com/showthread.php?threadid=54939 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the KeyPress event and check for KeyASCII of 13
cmpcwil2 wrote: Hello, What I want to do is... Using a vb comboBox the user will enter a string and hit return. Once return has been hit this will make a call to a db and search on the string entered, the results will populate the combobox. How do I detect when the return key has been pressed, in the comboBox? Thanks -- cmpcwil2 ------------------------------------------------------------------------ cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411 View this thread: http://www.excelforum.com/showthread...hreadid=549391 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I thought that the return key could not be detected in the keypress event only characters, I had tried this approach but without success. Let me know it may be that I'm approaching this wrong! Thanks for your help -- cmpcwil2 ------------------------------------------------------------------------ cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411 View this thread: http://www.excelforum.com/showthread...hreadid=549391 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, This works in the keydown event. Is it possible to modify this so tha it functions as a class module so that I don't have to repeat the cod in each of the 30 boxes I have on the worksheet. I have done thi before for the change event of a combo box, which makes a sub cal depending upon which combobox was used. Thank -- cmpcwil ----------------------------------------------------------------------- cmpcwil2's Profile: http://www.excelforum.com/member.php...fo&userid=3341 View this thread: http://www.excelforum.com/showthread.php?threadid=54939 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Yes it can be done, if anyone else has the same problem: this code in class module Public WithEvents ComboGroup As ComboBox Private Sub ComboGroup_KeyDown(ByVal KeyCode As MSForms.ReturnInteger ByVal Shift As Integer) If KeyCode = 13 Then carry out sub call end if end sub ******** init each combo box with class module in code module as follows: Dim Buttons() As New Class1 Sub init() Dim ctl As OLEObject Dim WS As Worksheet Dim ButtonCount As Integer 'Loop through each comboBox on each sheet For Each WS In Worksheets For Each ctl In WS.OLEObjects If TypeOf ctl.Object Is ComboBox Then ButtonCount = ButtonCount + 1 ReDim Preserve Buttons(1 To ButtonCount) Set Buttons(ButtonCount).ComboGroup = ctl.Object End If Next ctl Next WS End Sub Just in case anyone else has the same proble -- cmpcwil ----------------------------------------------------------------------- cmpcwil2's Profile: http://www.excelforum.com/member.php...fo&userid=3341 View this thread: http://www.excelforum.com/showthread.php?threadid=54939 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|