Datenfeld als Wert an sub übergeben?
08.05.2009 11:05:18
Wolli
Sub testA()
Dim x(2)
x(1) = "xxx"
x(2) = "yyy"
testB x()
Debug.Print "A" & x(1)
End Sub
Sub testB(x())
x(1) = x(1) & x(2)
Debug.Print "B" & x(1)
End Sub
In diesem Code übernimmt die Prozedur "testB" das Feld als Referenz, was zur Folge hat, dass nach dem Rücksprung in Prozedur "testA" das Datenfeld verändert ist. Will ich aber nicht.
Die Eingabe von "Sub testB(byVal x())" wird als Syntaxfehler abgelehnt.
Auch "Sub testB(ParamArray x())" funktioniert nicht.
Weiß jemand, wie's besser geht? Danke!
Gruß, Wolli