Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default ListBox value limit

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default ListBox value limit

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default ListBox value limit

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
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
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM
Nested IF limit or Open parentheses limit Fred Excel Discussion (Misc queries) 5 December 23rd 04 03:34 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 04:46 AM.

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

About Us

"It's about Microsoft Excel"