Results 1 to 3 of 3

Thread: [RESOLVED] Passing a form object to a Sub

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Location
    Grimsby (up the Mariners!)
    Posts
    45

    Unhappy [RESOLVED] Passing a form object to a Sub

    Had a problem today where I got a Type mismatch error when tying to pass a reference to Listbox object as a Sub parameter. I got round it by declaring the object as MSForms.Listbox instead of just plain Listbox.

    e.g.
    Code:
    Sub micListPre1(objListSelected As MSForms.Listbox)
    The initial error must mean that there is Listbox class declared in another Library somewhere. I searched the object browser for Listbox and found the only one to be in MSForms. There are also an xlListBox and xlDialogListBoxProperties as class members within the Excel library.

    Can anyone explain why I got the error in the first place? Beats me!
    Last edited by DavW; Jul 17th, 2003 at 06:51 AM.

  2. #2
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    There is a regular Listbox in the Excel object library. I guess it doen't show in the object browser because Excel embeds the control into a shape object.

    Here's an article from MSDN on the subject: http://support.microsoft.com/default...b;en-us;181466

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2002
    Location
    Grimsby (up the Mariners!)
    Posts
    45

    Thumbs up

    Exactly what I wanted to know!

    You are indeed a Workhorse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width