Read-Only ComboBox any ideas?

stevebausch

Well-known Member
Joined
May 11, 2002
Messages
810
It's possible in VB, but not VBA, least not in terms of properties.

Any ideas? I have searched for and found remedies, but most involve pages of API calls, etc.

Is it possible to simulate Read-Only in only a few lines?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi Im sorry I dont have an answer - this is way above my head :)

What I would like to know is why you would have a combo box as read only compared to justing locking the combo box? Whats the pros and cons in other words.

cheers
Parry
 
Upvote 0
Hi.
Will you be using the click event for an item in the list?
For now. This pretty much simulates read only.<pre>
Private Sub ComboBox1_Change()
ComboBox1.Text = "Please Select"
End Sub

Private Sub UserForm_Initialize()
With ComboBox1
.Text = "Please Select"
.AddItem "Item One"
.AddItem "Item Two"
.AddItem "Item Three"
End With
End Sub

Easy way to capture a selection..

Option Explicit
Dim SkipEvent As Boolean

Private Sub ComboBox1_Change()
If SkipEvent Then Exit Sub
SkipEvent = True
'capture selection here
ComboBox1.Text = "Please Select"
SkipEvent = False
End Sub

Private Sub UserForm_Initialize()
With ComboBox1
.Text = "Please Select"
.AddItem "Item One"
.AddItem "Item Two"
.AddItem "Item Three"
End With
End Sub</pre>
Tom
This message was edited by TsTom on 2002-08-22 20:44
 
Upvote 0
Yeah thats what I thought of originally Juan which is why I asked whats the diff between locked and read only?

cheers
Parry
 
Upvote 0
Would I be correct in thinking that readonly means no input into the combo box just selection with the down arrow, hence locking the box means you cant use the down arrow!

Brett
 
Upvote 0
Try the following if I understanded ur question, will only let the user select from the list , they can still type but it will pop up an invalid value box!


Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "Item One"
.AddItem "Item Two"
.AddItem "Item Three"
.MatchEntry = fmMatchEntryNone
.MatchRequired = True

End With
End Sub

Brett
This message was edited by brettvba on 2002-08-22 21:33
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,229
Members
448,879
Latest member
VanGirl

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