Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default ParamArray passed multiple times in nested procedures.

Hi,

Is it possible to pass a ParamArray variable through a number of nested
Sub-routines without using a sheet to dump the values and then re-read or
without getting added dimensions to the variable each time it is passed?

eg First routine called with parmarray, then passed to second procedure from
first.

thanks,

Paul.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default ParamArray passed multiple times in nested procedures.

Yes: assign it to a variant and then pass the variant.

Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Paul D Byrne." wrote in message
...
Hi,

Is it possible to pass a ParamArray variable through a number of nested
Sub-routines without using a sheet to dump the values and then re-read or
without getting added dimensions to the variable each time it is passed?

eg First routine called with parmarray, then passed to second procedure
from
first.

thanks,

Paul.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ParamArray passed multiple times in nested procedures.

In the procedure that you receive the ParamArray, you need to assign that
parameter to a variant variable, and then pass that variant variable on
down.

Public Sub Test()

Call FirstCalledSub(1, 2, 3)

End Sub

Sub FirstCalledSub(ParamArray val1())
Dim val2 As Variant
MsgBox val1(1)
val2 = val1
Call SecondCalledSub(val2)
End Sub

Sub SecondCalledSub(passedval As Variant)
Debug.Print passedval(0)
Debug.Print passedval(1)
Debug.Print passedval(2)
End Sub



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Paul D Byrne." wrote in message
...
Hi,

Is it possible to pass a ParamArray variable through a number of nested
Sub-routines without using a sheet to dump the values and then re-read or
without getting added dimensions to the variable each time it is passed?

eg First routine called with parmarray, then passed to second procedure
from
first.

thanks,

Paul.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default ParamArray passed multiple times in nested procedures.

Thanks Charles - have tested it and it works great.

cheers,

Paul.

"Charles Williams" wrote:

Yes: assign it to a variant and then pass the variant.

Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Paul D Byrne." wrote in message
...
Hi,

Is it possible to pass a ParamArray variable through a number of nested
Sub-routines without using a sheet to dump the values and then re-read or
without getting added dimensions to the variable each time it is passed?

eg First routine called with parmarray, then passed to second procedure
from
first.

thanks,

Paul.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default ParamArray passed multiple times in nested procedures.

Thanks Bob - that does the trick.

cheers,

Paul.

"Bob Phillips" wrote:

In the procedure that you receive the ParamArray, you need to assign that
parameter to a variant variable, and then pass that variant variable on
down.

Public Sub Test()

Call FirstCalledSub(1, 2, 3)

End Sub

Sub FirstCalledSub(ParamArray val1())
Dim val2 As Variant
MsgBox val1(1)
val2 = val1
Call SecondCalledSub(val2)
End Sub

Sub SecondCalledSub(passedval As Variant)
Debug.Print passedval(0)
Debug.Print passedval(1)
Debug.Print passedval(2)
End Sub



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Paul D Byrne." wrote in message
...
Hi,

Is it possible to pass a ParamArray variable through a number of nested
Sub-routines without using a sheet to dump the values and then re-read or
without getting added dimensions to the variable each time it is passed?

eg First routine called with parmarray, then passed to second procedure
from
first.

thanks,

Paul.




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
Proper procedures to delete multiple columns with 47,000 rows of data [email protected] Excel Discussion (Misc queries) 0 June 19th 08 06:01 PM
Shorter way to create multiple identical Event Procedures? Sam Kuo[_3_] Excel Programming 7 April 28th 08 01:48 AM
ParamArray values not being passed, Feb08 Neal Zimm Excel Programming 0 February 21st 08 04:36 PM
ParamArray Jim Chandler[_2_] Excel Programming 4 April 28th 04 03:28 PM


All times are GMT +1. The time now is 12:27 AM.

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"