|
-
Aug 9th, 2012, 03:55 AM
#1
Thread Starter
New Member
ListBox as Function Parameter
Hi there
I have some Listboxes on my UserForm and I'd like to have a function that does something to them.
Code:
sub test (myListBox as ListBox)
myListBox.addItem "test"
end sub
or something like this...
when i call that function it tells me "runtime error 424: object needed" (or something similar, sry, i have the german version...)
in debugging mode it tells me the listbox i try to edit is either Null, when its empty, or the item, that i added previously (in that case a string)
ive already searched the internetz for this, and found some similar problems with solutions, like that the listbox isnt even a listbox but an msforms.listbox but this doenst work for me (same error)
i dont get it, what im doing wrong...
greetz
Joshi
-
Aug 9th, 2012, 03:58 AM
#2
Thread Starter
New Member
Re: ListBox as Function Parameter
by the was the exact same code works for a combobox...
-
Aug 9th, 2012, 04:19 AM
#3
Thread Starter
New Member
Re: ListBox as Function Parameter
hmm, while testing i put parantheses around the object...
so the error i get is no "424 runtime error", but a "runtime error 13: type mismatch" (or similar)
sry...
-
Aug 9th, 2012, 04:56 AM
#4
Thread Starter
New Member
Re: ListBox as Function Parameter
it works!
seems like i made a mistake when i was trying around....
msforms.listbox DOES indeed work, i was just too stupid to only change the type and not mess everything else up 
ty everyone who helped!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|