ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform size limitation (https://www.excelbanter.com/excel-programming/303656-userform-size-limitation.html)

Michael Harrer

Userform size limitation
 
In my Excel-Addin I use lots of userforms (about 30) and there are lots of
code modules (about 30.000 LOC).

One of the userforms is quite complex, as there are several nested multipage
objects in there, which contain several textboxes, labels and the like. Now
I have come to the point where adding one single object to the userform
causes Excel to crash at accessing comboboxes (e.g. when accessing
..ListCount or .ListIndex property) at runtime. The project compiles fine,
but at runtime the first access to the above mentioned properties kills
Excel. The .AddItem or .RemoveItem methods work fine...

Moreover, I could only track down the problem by "wrapping" the userform
object into an object variable (the userform I'm talking about is named
"GewinnverteilungG":

'....
dim gg as object, z as long
set gg = GewinnverteilungG
with gg
.combobox1.clear
for z=1 to 17
.combobox1.additem str$(z)
next
.combobox1.listindex=0 <<<< crashes here, with error message
'...some other stuff...
end with
'...

executing this code gets me an error message that member function
".ListIndex" is not found in combobox.
When I leave the object assignment away, using

dim z as long
'....
with GewinnverteilungG
.combobox1.clear
for z=1 to 17
.combobox1.additem str$(z)
next
.combobox1.listindex=0 <<<< crashes here, without error message
' ...some other stuff...
end with

Excel doesn't even give me an error message on what's going wrong. I have
tried nearly everything, including completely rebuilding the userform,
cleaning the xls (i.e. exporting all the forms an modules, and re-importing
them into a new xls). The problem remains, only removing the last added
object (or any other!) fixes it.

So the only conclusion for me is that Excel just cannot handle this userform
anymore as it obviously is too big. It contains approximately 600 objects
(icons, comboboxes, listboxes, labels, optionbuttons, checkboxes,
multipages).

If I split the userform up into two several UF's, the problem is also gone.

So, does anyone out there know whether there is such a size limitation for
UF's?

Greetings and thanks in advance,
Michael Harrer




All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com