Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Variable in call statement

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 248
Default Variable in call statement

Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
..
..
..
as procedures
"Chip Pearson" wrote:


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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Variable in call statement

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have Test1 &
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As... wrote in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 248
Default Variable in call statement

You can use
i = 12
Application.Run "test" & i
to do what you want to do...

See http://support.microsoft.com/kb/171134

-------------------------------------
Pl. click ''''Yes'''' if this was helpful...



"donwb" wrote:

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have Test1 &
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As... wrote in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Variable in call statement

Yeah, you're right. I missed the boat on that one.

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 14:51:36 -0700, Sheeloo
just remove all As... wrote:

Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Variable in call statement

Many thanks Sheeloo for the answer:
that works fine.
Can't find <<Yes to click it,
though I know it's there somewhere.
donwb


"Sheeloo" just remove all As... wrote in
message ...
You can use
i = 12
Application.Run "test" & i
to do what you want to do...

See http://support.microsoft.com/kb/171134

-------------------------------------
Pl. click ''''Yes'''' if this was helpful...



"donwb" wrote:

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have Test1
&
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As... wrote in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 248
Default Variable in call statement

You see it only if you access the post through a browser... The only reason I
request an 'Yes' that it helps other who have similar issues.

Glad you got what you were looking for.

"donwb" wrote:

Many thanks Sheeloo for the answer:
that works fine.
Can't find <<Yes to click it,
though I know it's there somewhere.
donwb


"Sheeloo" just remove all As... wrote in
message ...
You can use
i = 12
Application.Run "test" & i
to do what you want to do...

See http://support.microsoft.com/kb/171134

-------------------------------------
Pl. click ''''Yes'''' if this was helpful...



"donwb" wrote:

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have Test1
&
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As... wrote in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Variable in call statement

Perhaps you should consider adjusting your signature to reflect this;
something like this maybe...

If you are viewing this response in a browser...
please click ''''Yes'''' if this answer was helpful.

--
Rick (MVP - Excel)


"Sheeloo" just remove all As... wrote in
message ...
You see it only if you access the post through a browser... The only
reason I
request an 'Yes' that it helps other who have similar issues.

Glad you got what you were looking for.

"donwb" wrote:

Many thanks Sheeloo for the answer:
that works fine.
Can't find <<Yes to click it,
though I know it's there somewhere.
donwb


"Sheeloo" just remove all As... wrote in
message ...
You can use
i = 12
Application.Run "test" & i
to do what you want to do...

See http://support.microsoft.com/kb/171134

-------------------------------------
Pl. click ''''Yes'''' if this was helpful...



"donwb" wrote:

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without
parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have
Test1
&
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As... wrote
in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 248
Default Variable in call statement

See the updated message below...

Is it appropriate even to ask for an 'Yes' response?


--

Pl click the ''Yes'' button,
- if you see it (don''t worry if you don''t) -
if this answer was helpful.



"Rick Rothstein" wrote:

Perhaps you should consider adjusting your signature to reflect this;
something like this maybe...

If you are viewing this response in a browser...
please click ''''Yes'''' if this answer was helpful.

--
Rick (MVP - Excel)


"Sheeloo" just remove all As... wrote in
message ...
You see it only if you access the post through a browser... The only
reason I
request an 'Yes' that it helps other who have similar issues.

Glad you got what you were looking for.

"donwb" wrote:

Many thanks Sheeloo for the answer:
that works fine.
Can't find <<Yes to click it,
though I know it's there somewhere.
donwb


"Sheeloo" just remove all As... wrote in
message ...
You can use
i = 12
Application.Run "test" & i
to do what you want to do...

See http://support.microsoft.com/kb/171134

-------------------------------------
Pl. click ''''Yes'''' if this was helpful...



"donwb" wrote:

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without
parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have
Test1
&
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As... wrote
in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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












  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 248
Default Variable in call statement

Thanks for your response... I just pointed it out hoping to learn something
new...

Do you think it is appropriate to ask for an 'Yes' response? I have also
asked Rick...

"Chip Pearson" wrote:

Yeah, you're right. I missed the boat on that one.

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

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Variable in call statement

I don't see why it wouldn't be appropriate... you are simply alerting
readers to the option and they are under no obligation to listen to your
request.

--
Rick (MVP - Excel)


"Sheeloo" just remove all As... wrote in
message ...
See the updated message below...

Is it appropriate even to ask for an 'Yes' response?


--

Pl click the ''Yes'' button,
- if you see it (don''t worry if you don''t) -
if this answer was helpful.



"Rick Rothstein" wrote:

Perhaps you should consider adjusting your signature to reflect this;
something like this maybe...

If you are viewing this response in a browser...
please click ''''Yes'''' if this answer was helpful.

--
Rick (MVP - Excel)


"Sheeloo" just remove all As... wrote in
message ...
You see it only if you access the post through a browser... The only
reason I
request an 'Yes' that it helps other who have similar issues.

Glad you got what you were looking for.

"donwb" wrote:

Many thanks Sheeloo for the answer:
that works fine.
Can't find <<Yes to click it,
though I know it's there somewhere.
donwb


"Sheeloo" just remove all As... wrote
in
message ...
You can use
i = 12
Application.Run "test" & i
to do what you want to do...

See http://support.microsoft.com/kb/171134

-------------------------------------
Pl. click ''''Yes'''' if this was helpful...



"donwb" wrote:

Hi Chip & Sheeloo

Chip thanks for the input - I'm ok with the with and without
parenthesis

But still have the problem.

Sheeloo - you're right - that's what I'm trying to do and I do have
Test1
&
Test2

but either the syntax is wrong or it's not possible.

donwb


"Sheeloo" just remove all As...
wrote
in
message ...
Chip,

I think what Don wants is to call procedures like
i=1
call test & i

assuming he has
test1
test2
.
.
.
as procedures
"Chip Pearson" wrote:


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











  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Variable in call statement

I access this News Group thru OutlookExpress
so presumably that's why I don't see "Click Yes"
donwb


"Sheeloo" just remove all As... wrote in
message ...
Thanks for your response... I just pointed it out hoping to learn
something
new...

Do you think it is appropriate to ask for an 'Yes' response? I have also
asked Rick...

"Chip Pearson" wrote:

Yeah, you're right. I missed the boat on that one.

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a Range variable to call a procedure with a ByVal statement... R Tanner Excel Programming 14 September 18th 08 08:40 PM
Can a variable be used when declaring an API call ? Mike Iacovou Excel Programming 3 July 23rd 07 03:19 AM
Call Statement and Return Value [email protected] Excel Programming 3 September 28th 05 08:56 PM
Macro Creating Variable and using variable in a SQL statement Jimmy Excel Programming 4 October 25th 04 02:36 AM
Can you call a macro as in an IF statement kls[_2_] Excel Programming 2 September 11th 04 10:48 PM


All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"