Problem with ComboBoxes

G

GD

I've have a recurrent problem in a somewhat huge Excel Vba application.

For 3 (out of more than a hundred) comboboxes, defining listindex doesn't
work anymore. It is not the last three controls in my form (not even the last
three comboboxes).
To be more precise, it works the first time, after i've made modifications
in VBA but it doesn't work anymore if i save the file, quit Excel and rerun
it.
It works perfectly if debugger is on (ie i enter visual basic editor and
type the password which protects my project).
Error message is : -2147417848 (80010108) ListIndex Method for IMDcCombo
object has failed (La méthode 'ListIndex' de l'objet 'IMDcCombo' a échoué)
and is followed by an Excel crash...

If i comment the 3 lines of code involved, program runs smoothly, Comboboxes
are initialized (with Additem Method) and i can select manually every value.

Problem occurs with XL XP (Windows XP Pro), XL 2003 (Windows NT), XL 2007
(Vista) in compatibility mode.
Problem doesn't seem to occur with new XL 2007 format but if i convert the
file back to XL 2003 format problem reappears!

It does not seem to be related with unqualified Office references (as
described in MS Q319832 Bulletin : i do not use in my program other Office
applications, error is present after leaving Excel (it crashes :)), it runs
with no reference to Microsoft Office 11 object Library)

I've spent a lot of time to try to find a workaround without success...If
somebody has an idea I will try it!

Thanks

GD
 
G

GD

I finally fix it!

It seems to be a sequel of 177842 (see KB) problem which I already
encountered a few years ago.
In the last evolution of my application I added direct reference to some
controls (userform.controlname) intead of using the form
userform.controls.item(number) I had put in place for Excel 97 compatibility

but...

1) This time the limit is not 411 controls (I've currently 844 controls in 1
form - The lowest control tabindex which gave me problem is #784 - Control
#620 was adressed the same way but gave me no problem)
2) The error is not triggered when executing a line with a direct reference
but seems to be triggered on the first listindex setting statement (for
comboboxes) even if this statement is using the controls.item reference!!! It
seems to me, that as soon there is a somewhere in your code a line with a
direct reference to this sort of control you have the problem on the first
listindex line (so it's why I take so long time to think it could be this
problem).
In fact, I had the problem with a checkbox too... this time the error was on
the line using the direct reference (it was a great help for me to understand
:))
3) Last but not the least : first problem (177842) was restricted to Excel
97 and 2000. This one affects all Excel versions (so far I know) : Excel
2002, 2003, 2007 in compatibility mode....

Hope it could help! :)

GD
 

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