Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there,
I've come across a weird issue with listbox value sizes. The code below adds an item to the list, that increments one character at a time. However, it falls over with a "2147352571 - Type mismatch" error. The length of the string at that stage is 2048. Can anyone tell why this is happening? Thanks John Private Sub UserForm_Initialize() Dim sCharacters As String For X = 1 To 3000 sCharacters = sCharacters & "a" Me.ListBox1.AddItem sCharacters Debug.Print CStr(Len(sCharacters)) Next X End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I believe that the max length that a string can be is 2048.
"John" wrote: Hi there, I've come across a weird issue with listbox value sizes. The code below adds an item to the list, that increments one character at a time. However, it falls over with a "2147352571 - Type mismatch" error. The length of the string at that stage is 2048. Can anyone tell why this is happening? Thanks John Private Sub UserForm_Initialize() Dim sCharacters As String For X = 1 To 3000 sCharacters = sCharacters & "a" Me.ListBox1.AddItem sCharacters Debug.Print CStr(Len(sCharacters)) Next X End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi AC,
Thanks for this. I'm curious though, because in another procedure I'm able to pass a string around so to speak, which is over 9000 characters in length? John "ACFalcon" wrote in message ... I believe that the max length that a string can be is 2048. "John" wrote: Hi there, I've come across a weird issue with listbox value sizes. The code below adds an item to the list, that increments one character at a time. However, it falls over with a "2147352571 - Type mismatch" error. The length of the string at that stage is 2048. Can anyone tell why this is happening? Thanks John Private Sub UserForm_Initialize() Dim sCharacters As String For X = 1 To 3000 sCharacters = sCharacters & "a" Me.ListBox1.AddItem sCharacters Debug.Print CStr(Len(sCharacters)) Next X End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) | Excel Programming | |||
Nested IF limit or Open parentheses limit | Excel Discussion (Misc queries) | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |