View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Variable in call statement


You don't need to use the Call keyword. You can use only the procedure
name. However, some folks like using Call, so do with it as you like.
Try code like

Sub AAA()
Call SomeOtherProc("abc",123)
' more code
End Sub

' Or

Sub AAA()
SomeOtherProc "abc",123
' more code
End Sub

If you are using the Call statement, you must enclose parameter list
within parentheses. If you do not use Call, you do not use the
parentheses when calling a Sub, since a Sub doesn't return a value.
But if you are calling a Function, you enclose the parameter list in
parentheses. E.g,

Dim V As Variant
V = SomeFunction("abc",123)

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 10 Apr 2009 21:54:52 +0100, "donwb"
wrote:

In Excel 2003, a statement <<Call SomeModule
will do just that and execute the code in <<Sub SomeModule.
Is it possible for the Call statement to comprise a fixed portion
AND a variable something like:-
Call Some & "Variable"
donwb