+ Reply to Thread
Results 1 to 5 of 5

[SOLVED]Excel 2010 Passing form control as parameter fails

  1. #1
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    [SOLVED]Excel 2010 Passing form control as parameter fails

    Hi everyone!

    I have a situation where I am trying to load three combo boxes with the same values. (They are each on separate sheets of a multipage control, where some sheets do not have the combobox.

    So, I'm using one procedure to select the comboboxes (LoadTravelerSelectors) and another to load the combobox passed as a parameter (LoadTravelerSelectorBox)

    Here's the code:
    Please Login or Register  to view this content.
    The comboboxes are all configured the same. The routine to get a traveler is tested and works properly.
    When I get to the first call to LoadTravelerSelectorBox, VBA hiccups with the message:
    Run time error 424: Object required

    Seems to me that I'm passing an object (a combobox. and expecting an object (Ctl as Control)

    This must be doable (I would suppose), so what else do I need to do?

    Thanks in advance for help,

    Tony
    Last edited by tfurnivall; 01-17-2014 at 01:05 AM. Reason: Solved!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Excel 2010 Passing form control as parameter fails

    Why are you declaring ctl as a control in your second routine?
    Please Login or Register  to view this content.
    You already declared it in the first routine.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Excel 2010 Passing form control as parameter fails

    What happens if you chose Debug in the error dialog then press shift F8 to step into the function?

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Excel 2010 Passing form control as parameter fails

    When to use ()'s or not is your problem I suspect. If you want to use ()'s, use Call.
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Excel 2010 Passing form control as parameter fails

    Thanks, Kenneth,

    I still get bitten by the parenthesis issue. I can't for the life of me figure out why MS decided to give us the option of omitting parentheses around procedure calls.

    Oh well - it solved the problem, thanks!

    Tony

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macros linked to entries in list box (form control) Excel 2010
    By zubair57 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2013, 07:50 AM
  2. Passing Excel Parameter to ODBC mysql query
    By bearclaw in forum Access Tables & Databases
    Replies: 3
    Last Post: 01-18-2013, 05:13 PM
  3. macro fails to function correctly when called from button form control
    By sarails in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-22-2011, 01:39 AM
  4. How do I remove a shadow from a Form Control Button in Excel 2010
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2011, 02:38 PM
  5. Passing Parameter between Excel and asp
    By jsy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-23-2006, 04:43 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1