Hi!
I'm using a separate procedure in which I enter 1 variable. This procedure should return 3 strings. I know how a function procedure can return 1 argument, but I can't find how to let it return several arguments. I tried via an array "parts()" but this doesn't work:
My code:
However, when I want to assign these values to a public variable, for example "reftablename" in another sub procedure, it returns an error saying the function or sub procedure "parts()" is not defined.
Can anyone help how to return the 3 values from the procedure?
Thanks a lot on forehand!
Leen
I'm using a separate procedure in which I enter 1 variable. This procedure should return 3 strings. I know how a function procedure can return 1 argument, but I can't find how to let it return several arguments. I tried via an array "parts()" but this doesn't work:
My code:
Code:
Function regexpparts(inputfield As String, ParamArray parts())
Dim parts
Dim regEx As Object
Dim number
Set regEx = CreateObject("vbscript.regexp")
With regEx
.Pattern = "(\b\w+?\b)"
.Global = True 'find all matches
End With
Set matches = regEx.Execute(inputfield)
number = matches.Count
parts(1) = matches(0)
parts(2) = matches(1)
parts(3) = matces(2)
Set matches = Nothing
Set regEx = Nothing
End Function
However, when I want to assign these values to a public variable, for example "reftablename" in another sub procedure, it returns an error saying the function or sub procedure "parts()" is not defined.
Code:
reftablename = reggexpparts(parts(1))
Can anyone help how to return the 3 values from the procedure?
Thanks a lot on forehand!
Leen