+ Reply to Thread
Results 1 to 7 of 7

Passing subroutine as a parameter

  1. #1
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Passing subroutine as a parameter

    I want to pass the name of the routine as a parameter.

    Please Login or Register  to view this content.
    so

    the code

    Please Login or Register  to view this content.
    should run macro 2 with the parameter of 7.




    I get errors every time I try it (with "calls", "runs",...)
    Last edited by jartzh; 03-26-2009 at 03:39 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Passing subroutine as a parameter

    works for me

    Please Login or Register  to view this content.
    Last edited by Andy Pope; 03-26-2009 at 12:05 PM. Reason: corrected ommission in code
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    05-02-2004
    MS-Off Ver
    2007
    Posts
    43

    Re: Passing subroutine as a parameter

    Andy, did you mean:

    Please Login or Register  to view this content.
    or you could use

    Please Login or Register  to view this content.
    TJ

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Passing subroutine as a parameter

    Indeed I did
    Thanks for the correction

  5. #5
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Re: Passing subroutine as a parameter

    I am still getting errors:

    My code is
    Please Login or Register  to view this content.
    but I get a "runtime error 13 type mismatch on the "run a(b).
    and a "compile error. expected sub,function,or property" fif I try call a(b)

    Thanks guys

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Passing subroutine as a parameter

    loadoverroutine had no argument which meant even after correcting the Run command it would still fail.

    Either add the argument to the loadoverroutine routine header or
    remove b from the Run command.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Re: Passing subroutine as a parameter

    That did it. A.P. is the man.

    Thanks.

    I love asking questions on this forum because I know there is going to be a remarkable solution.

+ 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