LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Unable to pass a control to a sub

I have the ListBox1 in a sheet (My Sheet), that is an embedded control. In
order to fill this listbox I call a sub located in Module1 that is something
like this:

Public Sub MySub (myListBox as ListBox)

myListBox.Clear
myListBox.AddItem ("John")
myListBox.AddItem ("Bill")
myListBox.AddItem ("Paul")

End Sub

When I call this sub from my sheet I call it like this:

Call MySub (Worksheets("My Sheet").ListBox1)

I get a Type-Mismatch error. I noticed that the listbox is Null and that the
same code works perfectly with a ComboBox instead of the ListBox.

Anyone knows I can I workaround this?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot pass argument from control to sub and back Revolvr Excel Programming 4 September 18th 08 06:46 PM
Function parameters: trying to pass a control Mole Hunter Excel Programming 8 May 7th 07 10:41 AM
Can I pass control to a 2nd workbook Alan Excel Programming 3 March 20th 07 01:26 PM
Unable to pass variable between Userforms PGM Excel Programming 2 April 18th 06 10:01 PM
Application.OnTime -- Unable to Pass Macro with Numeric Parameter Butaambala Excel Programming 7 June 7th 05 10:55 PM


All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"