Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:23:42+00:00 2026-06-09T00:23:42+00:00

I am trying to use the ActiveX ComboBox in excel. Everything works fine to

  • 0

I am trying to use the ActiveX ComboBox in excel. Everything works fine to the point of being populated from the drop down button click_event. But when it set the click event I find it is triggered even from keystrokes like the Arrow keys. Is this normal behavior, and if so how can I bypass this?

I am working on Excel 2007 VBA

This is the method i used to allow navigating in the combo box using keys , i will wait to see if there is a better solution.. : lastkey is a public variable

Private Sub ComboBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
    If KeyCode = 38 Then
        If ComboBox1.ListIndex <> 0 Then
            lastkey = KeyCode
            ComboBox1.ListIndex = ComboBox1.ListIndex - 1
            KeyCode = 0
        End If
    ElseIf KeyCode = 40 Then
        If ComboBox1.ListIndex <> ComboBox1.ListCount - 1 Then
            lastkey = KeyCode
            ComboBox1.ListIndex = ComboBox1.ListIndex + 1
            KeyCode = 0
        End If
    End If
End Sub

Private Sub ComboBox1_Click()
    If lastkey = 38 Or lastkey = 40 Then
        Exit Sub
    Else
        MsgBox "click"
    End If
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:23:44+00:00Added an answer on June 9, 2026 at 12:23 am

    Yes this is normal behavior. Using the arrow keys navigates the items in the combo and hence the click event is fired.

    To bypass that insert this code. This captures all the 4 arrow keys and does nothing when it is pressed. The only drawback of this method is that you will not be able to navigate using the Arrow keys anymore.

    Private Sub ComboBox1_KeyDown(ByVal KeyCode As _
    MSForms.ReturnInteger, ByVal Shift As Integer)
        Select Case KeyCode
        Case 37 To 40: KeyCode = 0
        End Select
    End Sub
    

    FOLLOWUP

    Dim ArKeysPressed As Boolean
    
    Private Sub ComboBox1_Click()
        If ArKeysPressed = False Then
            MsgBox "Arrow key was not pressed"
            '~~> Rest of Code
        Else
            ArKeysPressed = False
        End If
    End Sub
    
    Private Sub ComboBox1_KeyDown(ByVal KeyCode As _
    MSForms.ReturnInteger, ByVal Shift As Integer)
        Select Case KeyCode
        Case 37 To 40: ArKeysPressed = True
        End Select
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Crystal Reports ActiveX Viewer 13 from within Winforms. While
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Trying to use Powershell to script the removal of specific custom errors from an
I have a (COM Interop based) ActiveX contol that I am trying to use
I saw a ActiveX plugin for FireFox here I'm trying to use a Bematech
Using vs2008 .NET 3.5 SP1 I am trying to use an ActiveX dll in
iam trying to record sound from an activex WMP control playing an internet radio
I am trying to use the Address plugin from http://www.asual.com/jquery/address/ and I really need
I stumbled upon this while trying to build an ActiveX dll from an old
i'm trying use facebook API to upload photo in my fan page. I downloaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.