commandbarCombobox problem

G

Guest

I have a short cut menu with one commandbarCombobox control.
user right clicks on a cell, short cut menu appears with combo control.
clicking on the arrow opens the list and chooses and item that sits the cell.
This works fine.

but..
on right clicking, shortcut menu with control appears. on clicking inside
the combo control, it highlights the text in the combo control. If user hits
enter, it opens another excel file.

what is causing this? what event is fired on "ENTER" key. How do I trap
this event?

Thanks
MVM
 
G

Guest

Here is my OnAction procedure. This works fine as said before. I tried
stopping the code in this procedure. It is not getting into this procedure
when I hit "Enter"

Public Sub GetCode()
Dim myControl As CommandBarComboBox
Application.EnableEvents = False
Set myControl =
Application.CommandBars("MyBar").FindControl(Type:=msoControlComboBox)
If myControl.ListIndex = 0 Then
MsgBox "Your entry is invalid. It is not in my list", vbCritical,
"Invalid Entry"
Application.EnableEvents = True
Exit Sub
End If
tRange.Cells(1, 1) = myControl.List(myControl.ListIndex)
Application.EnableEvents = True
End Sub
 
T

Tom Ogilvy

you asked:
on clicking inside
the combo control, it highlights the text in the combo control. If user hits
enter, it opens another excel file. .. . .
what event is fired on "ENTER" key. ?

The answer is: the macro assigned to the onaction property.
This works fine as said before.

Based on this statement I went back and carefully reread your posting. It
appeared to indicate that when the use clicked inside the combobox (the
entry was highlighted) and hit enter, it opens another excel file. Doing
this should fire the macro assigned to the onaction property. If that is
not the case and everything is working fine, then I am not sure why you are
posting.
 
G

Guest

Thank you Tom for being patient with me.
right click -> drop the list --> select an item double click --> item is
copied to the cell. --- works fine as intended.

right click -->click inside the combo control -->high lights the item shown
in the control --> "ENTER" ---this opens onother file and don't do the
intended.

I put a stop in the GetCode procedure. It is not entering the function.
I have no clue how it is opening another file. Any suggestions are
appreciated.

Thanks
MVM
 
T

Tom Ogilvy

I can't duplicate that situation. If it isn't firing the macro assigned,
then the keystroke must be going elsewhere.

Assuming you have not redefined it with OnKey, then I really can't say.
Assume you don't have any code anywhere in an open workbook which could
possibly open this other file. Perhaps unload any 3rd party addins,
unassign the macro, and have only open a single blank workbook and see if
you can reproduce it. If not, start adding things back.

In my testing, doing what you describes fires the assigned macro.
 
T

Tom Ogilvy

One other thought. Is it the same workbook all the time. If so, does the
workbook have a macro that executes when it opens. If you are triggering
some other control that has a macro assigned from this foreign workbook,
that would be the cause for it opening. How you are triggering that control
I can't say.

Also assume you are not creating a reference to that strange workbook.
 
G

Guest

Tom:
Thanks for your help.
I noticed it is not at all working in either way. I was not tring the
dropdown -->select way -- I took it granted that it is working.

what is happening is this:
My Popup is created in the previous file. when we are invoking that in this
file it is opening that file and trigering the OnAction function from that
file.

I am now deleting the PopUp in worksheet_beforeclose event. Now all is ok.
Thanks again for your support.
MVM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top