Shurov
Shurov

Reputation: 401

VBA ListBox crashes when adding too long line

I need to populate ListBox with lines (so I'm using 1 column without specified column width) by ListBox1.AddItem command. When the line is too long (about 10k characters :) ), Excel returns a runtime error '-2147352571 (80020005)': Type Mismatch.

When I was using TextBox, it worked correctly.

Moreover, how can I add horizontal scrollbar to the ListBox?

Upvotes: 0

Views: 325

Answers (1)

MiguelH
MiguelH

Reputation: 1425

I think there is a 1,024 character limit on a listbox line. Could you populate an array where the input is chunked down to 1024 characters and then populate the listbox from the array?

Upvotes: 2

Related Questions