Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Location
    England.
    Posts
    232

    Unanswered: Passing variables between subs.

    I have a routine (1) which calls another routine (2). Routine 2 has this for it's declaration line...

    Code:
    Sub cdAddDropDown(strWhat As String, intCell As Integer)
    Routine 1 calls routine 2 like this ....
    Code:
    cdDropDowns.cdAddDropDown (strroutine, Target.row)
    The problem I have is that it errors when trying to complete routine 1 saying that it's expecting an '=' somewhere.

    Can you see what I am doing wrong at all please?

    TIA

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi Daveo

    Knock out the brackets in your call to the sub. Brackets make VB think you are calling a function. You could instead precede the line with the optional key word 'Call'. I go with the latter as I like it to be explicit that I am calling a proc.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2005
    Location
    England.
    Posts
    232
    Ta Pootle, as always I'm humbled.

    Thanks!

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by daveo61
    Ta Pootle, as always I'm humbled.
    No need to be - short of some techie or historical reason it seems bloomin' silly to me.
    Another use for call - if you have a function that does stuff but you aren't interested in the output you can use call - this allows you to ignore the return (i.e. you don't have to go to the trouble of sticking it into a variable).
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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