ComboBox text Limit

G

geoff_francis_cox

Hi all you Experts

I need to create a dropdown list in a form field that will allow users to
choose from the entries that are pre-populated. As my list is going to be
longer than 25 entries I have used a Userform with a combo box.

As far as I can tell, each entry in the list is limited to 50 characters,
but some of my choices will need to be double this length. Is there any way
of using VBA code to increase the number of characters available?
 
D

Doug Robbins - Word MVP

The limit maybe 255 characters, but it is definitely not 50.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
G

Graham Mayor

Just because the userform display is limited, it does not follow that the
result of the selection has to be.
In any case it is not true that the entries are limited in length to 50
characters. You can get as many characters as you can display in the width
of the screen and even if the entry spreads beyond the display its content
is valid. Try this code associated with a userform with a single command
button and a combobox

Option Explicit

Private Sub CommandButton1_Click()
Selection.TypeText Me.ComboBox1.Value
Unload Me
End Sub

Private Sub UserForm_Initialize()
With Me.ComboBox1
.AddItem "This is a very long entry - Lorem ipsum dolor sit amet," & _
"consectetuer adipiscing elit, sed diam nonummy nibh euismod " & _
"tincidunt ut laoreet dolore magna aliquam erat volutpat. " & _
"Ut wisi enim ad minim veniam, quis nostrud exerci tation " & _
"ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo " & _
"consequat. Lorem ipsum dolor sit amet, consectetuer adipiscing " & _
"elit, sed diam nonummy nibh euismod tincidunt ut laoreet " & _
"dolore magna aliquam erat volutpat. This is the end of it."
.AddItem "This is a shorter entry"
End With
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

geoff_francis_cox

Graham and Doug

Thanks you both for your replies. I have tried my code again and this time
it IS populating more than 50 characters. I'm not sure what I have done
differently today, as it certainly didn't work yesterday.

Anyway, thank you both for taking the time to reply - much appreciated.

Geoff
 

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