+ Reply to Thread
Results 1 to 5 of 5

Passing Object reference correctly?

  1. #1
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Passing Object reference correctly?

    I am currently getting a run-time error 424: object required error.... So I'm not real clear on how to properly pass the object.

    A little background explanation is due:

    From the start, the following works flawlessly, I can click the button and the desired effect works without problem.

    Please Login or Register  to view this content.

    However, later on while doing further "processing" of data I try to call the function again ...

    Please Login or Register  to view this content.
    It seems that I am not passing the correct reference to the object (ToggleButton) to the function. Here is where the error occurs.

    Please Login or Register  to view this content.

    Example file attached for review. If you try the attachment, simply open the file and click the "Return & Add" button. Your suggestion are welcome. Thx.
    Attached Files Attached Files
    Last edited by e.good; 01-30-2011 at 12:43 PM.

  2. #2
    Registered User
    Join Date
    07-27-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Passing Object reference correctly?

    It looks like you're passing tb as a string rather than an object - try removing .name from the call to SwapToggleState.

  3. #3
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Passing Object reference correctly?

    Thanks for the suggestion Dom83. However this does not solve the problem. By passing 'ob' in place of 'ob.name' results in run-time error 438: object doesn't support this method or property. Other suggestions?

  4. #4
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Passing Object reference correctly?

    I still haven't figured this out up to this point. However, I have found a workaround and so no longer need to find a solution. My workaround is to set the obj.value to false which triggers the ToggleButton_Click event and everything works smoothly.

    Do I mark this as solved?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Passing Object reference correctly?

    Function signatures should specify the types of their arguments.

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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