I am looking for a general snippet that can be used to capture in an array, the arguments which were passed to the current procedure or function. I visualize something akin to the following, but do not know of any way to determine properties of a procedure such as which arguments were passed to it.
Any insight will be greatly appreciated.
[codebox] For ctr = 1 To PassedArguments.Count
myArray(ctr) = PassedArguments(ctr)
Next
[/codebox]
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Capturing Arguments passed to a Procedure
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Capturing Arguments passed to a Procedure
- This topic has 7 replies, 6 voices, and was last updated 16 years, 2 months ago.
AuthorTopicDon Wells
AskWoody LoungerMarch 1, 2009 at 8:18 am #457915Viewing 2 reply threadsAuthorReplies-
WSHansV
AskWoody Lounger -
Don Wells
AskWoody Lounger -
WSrory
AskWoody LoungerMarch 3, 2009 at 5:12 am #1149843Thank you Hans
I have come to the same conclusion. Passing the array as an argument achieves the desired results with no added agony.If you were not using ParamArray, then you could simply declare the array and populate it as required given that you know at design time what the inputs are. I’m not really sure what purpose it would serve though?
-
-
-
WSpieterse
AskWoody LoungerMarch 3, 2009 at 8:31 am #1149876What I sometimes do is use a custom type. This makes adding an argument simple:
[codebox]Option Explicit
Public Type People
FirstName As String
LastName As String
Street As String
End TypeSub Example()
Dim tPerson As People
With tPerson
.FirstName = “Jan”
.LastName = “Pieterse”
.Street = “Churchlane”
End With
ShowPerson tPerson
End SubSub ShowPerson(tPerson As People)
With tPerson
MsgBox .FirstName & ” ” & .LastName & vbNewLine & .Street
End With
End Sub
[/codebox] -
WSchrisgreaves
AskWoody LoungerMarch 3, 2009 at 8:59 am #1149882What I sometimes do is use a custom type.
Me too.
In particular, within a VBA project, or better yet, within a client’s project (which may consist of several VBA Application projects), if I can create a self-descriptive TYPE, I can do all sorts of useful debugging things.
A self-descriptive TYPE being one where the first item is, say, a LONG that describes the number of dimensions of a parameter array, the next Val(lng) items are the size of each dimension, and then next item is the array.
Or sometimes, paired items that tell me the type as well as the dimension.
And so on.MARC library records were a popular example of this technique years ago.
I wish that VBA made available to us poor mortals the descriptors of data, so we could interrogate them instead of relying on trial and On Error.
-
-
WSAlanMiller
AskWoody LoungerMarch 4, 2009 at 6:28 am #1150029I am looking for a general snippet that can be used to capture in an array, the arguments which were passed to the current procedure or function.
I’m not sure what you’re wanting to do here, but I’ve often used the Join and Split functions to “carry” multiple values in a single (global?) variable, which can be easily transformed to an array. See VB String Array Functions – Split, Join, Filter (VB6) for example.
Alan
-
Don Wells
AskWoody LoungerMarch 4, 2009 at 8:17 pm #1150279I’m not sure what you’re wanting to do here, but I’ve often used the Join and Split functions to “carry” multiple values in a single (global?) variable, which can be easily transformed to an array. See VB String Array Functions – Split, Join, Filter (VB6) for example.
Alan
Thanks for the input Alan
As soon as I hit the send button on my original post I realized that if I wanted to create an array of arguments in the called procedure, the simplest way would be to create the array in the calling procedure and pass the array.
-
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Debian 12.11 released
by
Alex5723
1 hour, 7 minutes ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
4 hours, 48 minutes ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 hours, 18 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
1 hour, 16 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
21 hours, 43 minutes ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
12 hours, 8 minutes ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
16 hours, 39 minutes ago -
Some advice for managing my wireless internet gateway
by
LHiggins
12 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
18 hours, 36 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
1 day, 9 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
1 day, 6 hours ago -
Does windows update component store “self heal”?
by
Mike Cross
20 hours, 13 minutes ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
1 day, 23 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
7 hours, 47 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
11 hours, 28 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
2 days, 2 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
2 days, 2 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 day, 15 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
2 days, 10 hours ago -
0Patch, where to begin
by
cassel23
2 days, 4 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
3 days ago -
89 million Steam account details just got leaked,
by
Alex5723
2 days, 12 hours ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
3 days, 8 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
2 days, 23 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
2 hours, 2 minutes ago -
Installer program can’t read my registry
by
Peobody
1 hour, 35 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
2 days, 21 hours ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
3 days, 4 hours ago -
False error message from eMClient
by
WSSebastian42
3 days, 20 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.