I'm trying to set passed arguments directly to an array for ease of use. As an example what I currently do is similar to:
However this seems like a waste of code. What I was hoping to do was something akin to:
This would allow me to use these in for loops straight away. Is this possible? It's not a huge deal and what I'm doing works fine but issues mostly arise when there's much more than 4 arguments and when I'm debugging I have to step over these lines multiple times. It can be infuriating.
I'm hoping I'm missing something straight forward, such as a means to refer to arguments directly like "arguments[0]".
Code:
Sub Macro1(arg1 As String, arg2 As String, arg3 As String, arg4 As String)[INDENT]Dim args(1 to 4) as String[/INDENT]
[INDENT]args(1) = arg1[/INDENT]
[INDENT]args(2) = arg2[/INDENT]
[INDENT]args(3) = arg3[/INDENT]
[INDENT]args(4) = arg4
for a = 1 to 4[/INDENT]
[INDENT=2]args(a)....blahblah[/INDENT]
[INDENT]next a[/INDENT]
End Sub
However this seems like a waste of code. What I was hoping to do was something akin to:
Code:
Sub Macro1(args(1) As String, args(2) As String, args(3) As String, args(4) As String)
This would allow me to use these in for loops straight away. Is this possible? It's not a huge deal and what I'm doing works fine but issues mostly arise when there's much more than 4 arguments and when I'm debugging I have to step over these lines multiple times. It can be infuriating.
I'm hoping I'm missing something straight forward, such as a means to refer to arguments directly like "arguments[0]".