Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default ComboBox Dropdown not under control


ComboBox on a Userform.

I am using the following code to display the dropdown list for a ComboBox
when the user enters the ComboBox. However, when the form opens, the dropdown
list for the first Combo box is towards the top left of the screen outside of
the Userform instead of under the ComboBox control on the Userform. This
occurs in both xl2002 and xl2007. If I reduce the size of the Excel window,
the dropdown can be completely off the Excel window also.

I can actually make a selection form the dropdown.

It is almost like the drop down list is positioned relative to the top left
of the screen instead of the userform.

Any help to fix this problem will be greatly appreciated.

Private Sub ComboBox1_Enter()
If Me.ComboBox1.ListCount 0 Then
Me.ComboBox1.DropDown
End If
End Sub

--
Regards,

OssieMac
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default ComboBox Dropdown not under control

I now have a workaround for this in the following code example. Just set the
focus to another control that does not have an Enter event and then set it
back to the first combo box.

I feel fairly sure that what is occurring is that the dropdown is being
displayed before the form is painted and hense Excel does not know where to
position it and it gets positioned relative to the screen Top and Left
instead of the Form Top and Left.

Still interested (just curiosity) if anyone has another explanation or
alternative workaround.

Private Sub UserForm_Activate()
Me.CommandButton1.SetFocus
Me.ComboBox1.SetFocus
End Sub

--
Regards,

OssieMac


"OssieMac" wrote:


ComboBox on a Userform.

I am using the following code to display the dropdown list for a ComboBox
when the user enters the ComboBox. However, when the form opens, the dropdown
list for the first Combo box is towards the top left of the screen outside of
the Userform instead of under the ComboBox control on the Userform. This
occurs in both xl2002 and xl2007. If I reduce the size of the Excel window,
the dropdown can be completely off the Excel window also.

I can actually make a selection form the dropdown.

It is almost like the drop down list is positioned relative to the top left
of the screen instead of the userform.

Any help to fix this problem will be greatly appreciated.

Private Sub ComboBox1_Enter()
If Me.ComboBox1.ListCount 0 Then
Me.ComboBox1.DropDown
End If
End Sub

--
Regards,

OssieMac

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox.DropDown not working Corey ....[_2_] Excel Programming 2 July 7th 08 06:54 AM
combobox dropdown pswanie Excel Programming 6 January 19th 08 04:21 PM
Disable and enable dropdown combobox(Form Control) Vinod[_2_] Excel Discussion (Misc queries) 0 November 6th 07 07:30 PM
Dim CTL as MSForms.Control always sets as Control/Combobox Post Tenebras Lux Excel Programming 2 August 11th 06 06:51 AM
ComboBox DropDown when Key is pressed shrekut[_9_] Excel Programming 2 February 2nd 04 11:30 PM


All times are GMT +1. The time now is 12:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"