Results 1 to 3 of 3
  1. #1

    Function with 2 parameters

    While compilation of a function with two arguments with paranthesis there is a error "Cannot use paranthesis when calling a Sub" (it is working fine without paranthesis) When the same function is passed with one parameter and enclosed with paranthesis it works fine. Any idea on this behaviour? Just curious to know

  2. #2
    Senior Member
    Join Date
    Feb 2008
    Los Angeles, CA, USA

    Re: Function with 2 parameters

    When you call a sub with parameters enclosed in paranthesis, use Call statement or do not use paranthesis. Its vbscript basics

    <ul type="square">
    Correct[*]Call Sub1 (param1, param2)
    Incorrect[*]Sub1 (param1, param2)

    Incorrect[*]Call Sub1 param1, param2
    Correct[*]Sub1 param1, param2[/list]

  3. #3

    Re: Function with 2 parameters

    Thanks for your response Suchit

    My curiosity is why is it working fine when I am passing the argument WITH paranthesis for a SINGLE argument and fails to recognise when there are two arguments

    Function("arg1") - Works fine
    Function("arg1, "arg2") - throws the "Cannot use paranthesis when calling a Sub" error

    call Function("arg1", "arg2") works fine



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:42 PM.

Copyright BetaSoft Inc.