+ Reply to Thread
Results 1 to 6 of 6

VBA code: call subprocedure

  1. #1
    Terry
    Guest

    VBA code: call subprocedure

    Hi,
    I am writing a VBA program。The program structure listed below:

    Private Sub b(i As Integer, j As Integer)
    ......
    End Sub

    Sub a()
    ....
    b (i, j)
    ...
    End Sub

    It appeard error message while I call subprocedure b in main-procedure a.
    Error message :
    Compile error
    Miss :=

    Would you tell me how to write the code in order to call the subprocedure b?
    Thanks a lot!



  2. #2
    bpeltzer
    Guest

    RE: VBA code: call subprocedure

    Put the word call in front of the procedure call: call b(i,j). Not entirely
    sure why, but the help suggests: "a function call can't stand by itself, and
    Sub procedure calls sometimes require the Call keyword, depending on how you
    specify their arguments."


    "Terry" wrote:

    > Hi,
    > I am writing a VBA program隆拢The program structure listed below拢潞
    >
    > Private Sub b(i As Integer, j As Integer)
    > ......
    > End Sub
    >
    > Sub a()
    > ....
    > b (i, j)
    > ...
    > End Sub
    >
    > It appeard error message while I call subprocedure b in main-procedure a.
    > Error message :
    > Compile error
    > Miss :=
    >
    > Would you tell me how to write the code in order to call the subprocedure b?
    > Thanks a lot!
    >
    >
    >


  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Terry,

    When calling a Sub procedure with parentheses like b(i, j), you must precede the cal with the keyword Call...

    Call b(i,j)

    Sincerely,
    Leith Ross

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Terry,

    When calling a Sub procedure with parentheses like b(i, j), you must precede the cal with the keyword Call...

    Call b(i,j)

    Sincerely,
    Leith Ross

  5. #5
    Terry
    Guest

    Re: VBA code: call subprocedure

    Thank you very much!
    "bpeltzer" <[email protected]> 写入消息新闻:[email protected]...
    > Put the word call in front of the procedure call: call b(i,j). Not
    > entirely
    > sure why, but the help suggests: "a function call can't stand by itself,
    > and
    > Sub procedure calls sometimes require the Call keyword, depending on how
    > you
    > specify their arguments."
    >
    >
    > "Terry" wrote:
    >
    >> Hi,
    >> I am writing a VBA program?£The program structure listed below£o
    >>
    >> Private Sub b(i As Integer, j As Integer)
    >> ......
    >> End Sub
    >>
    >> Sub a()
    >> ....
    >> b (i, j)
    >> ...
    >> End Sub
    >>
    >> It appeard error message while I call subprocedure b in main-procedure a.
    >> Error message :
    >> Compile error
    >> Miss :=
    >>
    >> Would you tell me how to write the code in order to call the subprocedure
    >> b?
    >> Thanks a lot!
    >>
    >>
    >>




  6. #6
    Terry
    Guest

    Re: VBA code: call subprocedure

    Thank you very much!
    "Leith Ross" <[email protected]> 写入消息新闻:[email protected]...
    >
    > Hello Terry,
    >
    > When calling a Sub procedure with parentheses like b(i, j), you must
    > precede the cal with the keyword Call...
    >
    > Call b(i,j)
    >
    > Sincerely,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile:
    > http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=493258
    >




+ 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