Kamis, 13 Desember 2012

[ExcelVBA] Using Parentheses in Subroutine Calls

 

The rule is that if you call a subroutine using the Call keyword, you
must enclose the argument list in parentheses. That is
Call Test(a, b)
is correct. But if you omit Call, you must not use parentheses, so that
Test a, b
is also correct. I didn't know these rules, and, from habit, I do not
use Call and do use parentheses. I got away with that for a long time
because my subroutines used only 1 argument. Surprisingly,
Test (c)
works even though it violates the rule. I got into trouble only when I
wrote a subroutine that used 2 arguments.
Test (c, d)
causes a syntax error. Does anyone know why the single argument works
with a parentheses?

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar