First, of course a List box (it has it's default name List1) is not a variable.
I tried variables that were close because Visual Basic gets "confused" about its error messages (as when one has nested strings and it lists the wrong one an error)

Oddly the current version I'm using doesn't have this error but I can't find the older (working) .BAS module to plug back in!

I have a working compiled version but would really like to change a file location for security reasons.

I've tried making sure the form that contains the list box was Loaded using Load (Form containing said List1 listbox) and also Form.Show for good measure. No luck.

I'm stumped but this is not unusual as I program during summers (with the occasional year or too off - so calling my skills rusty is an understatement) as I'm a teacher and not spend all my time on a word processor perfecting curriculum.

I've also tried using a Dim statement on everything it might consider a variable and other true "hacker" (not cracker) tricks.

So if you've ever had this error I'd very much appreciate you to take a second to explain what error I've made.
------------------------------------------------
Like losing your keys, wallet, cellphone, and iPod now, an unsolved bugs will can cause one to become obsessive in search FINDING it.

If I manage to find the WORKING BAS file I'll edit or respond to my own post.

I found a working .BAS file finally and now it works. I didn't take the time to figure out what was wrong. Help files state that ListIndex(X) can only be accessed at run time but of course since it was working as the code was running I figured it would work even if I used code to change the index number.
Go figure. Oh by the way, for anyone running VB4 out there like me. I'd love to upgrade to Visual Basic 6 (I'm still running 4!) for two reasons: 1) I'm cheap.
2) This takes me even further from the bible of basic commands that I fear Microsoft would change because they live to change things and often make life harder while learning them.
---------------------------------------------------------------
Finding a bug is like losing your pocketbook, cellphone, keys or iPod, it causes one to obsess until the problem is solved. - me (But then seasoned pros like yourselves are more desensitized to this.)

I would gues it was the reference to the "x" at your listindex whixh was not properly declared. It is quite easy to rectify -

Dim x As Integer

For x = 0 To List1.ListCount
'Code Here
Next x

Andre!...

that would be...

For x = 0 to List1.ListCount - 1

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.