Enter Key behavior

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
574
Office Version
  1. 365
Platform
  1. Windows
I have an ActiveX ComboBox and it uses a list to fill the drop down. When the user selects a company from the list, they click on the icon next to the ActiveX field to initiate the search macro. I would like to include code on the ActiveX ComboX so that when it loads, or is displayed, the ability to use the enter key is either disabled, or that the search macro is assigned to that keystroke. Is it possible to do this?

Thanks for the assistance.

Robert
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
how about

Code:
Private Sub ComboBox1_GotFocus()
    Application.OnKey "~", "NoEnter"
    Application.OnKey "{Enter}", "NoEnter"
End Sub

Private Sub ComboBox1_LostFocus()
    Application.OnKey "~", ""
    Application.OnKey "{Enter}", ""
End Sub
 
Upvote 0
Is it possible to make the enter key run my search macro via "Call Search1" or something like that?
 
Upvote 0
Put macro Search1 in a standard module and call it like this within the ComboBox code

Code:
    Application.OnKey "~", "Search1"
    Application.OnKey "{Enter}", "Search1"
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top