Results 1 to 8 of 8

passing a ParamArray to another sub that accepts a ParamArray

Threaded View

ffffloyd passing a ParamArray to... 02-10-2018, 04:54 AM
Kyle123 Re: passing a ParamArray to... 02-10-2018, 05:00 AM
ffffloyd Re: passing a ParamArray to... 02-10-2018, 05:11 AM
Kyle123 Re: passing a ParamArray to... 02-10-2018, 05:05 AM
Kyle123 Re: passing a ParamArray to... 02-10-2018, 06:00 AM
ffffloyd Re: passing a ParamArray to... 02-10-2018, 06:19 AM
Kyle123 Re: passing a ParamArray to... 02-10-2018, 02:32 PM
daboho Re: passing a ParamArray to... 02-10-2018, 03:05 PM
  1. #1
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    passing a ParamArray to another sub that accepts a ParamArray

    I have a number of subroutines that accept a ParamArray for an indeterminate number of parameters, viz:
    Sub CheckList(ParamArray vList())
    '
    ' checks stuff
    '
    End Sub
    
    Sub PrintList(sMessage as String, ParamArray vList())
    '
    ' prints stuff
    '
        CheckList vList
        CheckList vList()
        CheckList Array(vList())
    End Sub
    It doesn't seem to matter how I try to pass the array from PrintList to CheckList, I always seem to end up with something other than the array I started with. It starts off as an array of variants and appears to become a one element array of (an array of variants). That is, in CheckList, vList(0) contains the original array that was passed to PrintList.

    This can go more than one level deep. In actuality, PrintList may be called directly or it may be called by another subroutine that has a ParamArray vList(). When that happens, CheckList receives a one element array of (a one element array of (an array of variants)).

    It seems messy to have to write code to potentially unpack the array at each level. What is the way of passing a ParamArray to a ParamArray and ending up with exactly the same ParamArray?

    Cross-posted to Mr Excel:
    https://www.mrexcel.com/forum/excel-...aramarray.html
    Last edited by ffffloyd; 02-10-2018 at 07:14 AM. Reason: note re cross-posting
    _______________
    Floyd Emerson
    Business Intelligence Consultant
    Perth, Western Australia

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Udf paramarray
    By daboho in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-29-2017, 10:07 AM
  2. How to define a Paramarray( ) with two arguments
    By Debraj Roy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2015, 08:24 PM
  3. VBA Function ParamArray parameter drop-down
    By onidarbe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2013, 03:05 PM
  4. optimise code -> subroutine to function (paramarray??!)
    By tozjerimiah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2011, 10:00 AM
  5. passing ParamArray to ParamArray
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2009, 11:47 AM
  6. [SOLVED] Textbox accepts alpha only
    By LeLi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2005, 04:05 AM
  7. TextBox that only accepts integers?
    By Claud Balls in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2005, 07:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1