nimm doch Evaluate für @unique in Script.
Gab dazu letzte haufenweise Beispiele im Entwicklerforum.
Oder:
Sub Click(Source As Button)
Dim newitem$, reslist$, ulist As Variant
newitem = "Notes is kewl"
x = 0
REM prompt the user for items for the array till they quit
Do While newitem <> ""
If newitem <> "" Then
Redim Preserve slist(x) As String
REM InputBox[$] ( prompt [ , [ title ] [ , [ default ] [ , xpos , ypos ] ] ] )
newitem = Inputbox$("Enter another item to add to the list." & Chr$(10) & "Click Cancel when you are done.", "Enter Item", newitem)
slist(x) = newitem
x = x + 1
End If
Loop
REM run the array through the unique function
ulist = Unique(slist)
REM Now set up the result so it can be displayed to the user
Forall u In ulist
reslist = reslist & Chr$(10) & u
End Forall
Msgbox "The unique list is:" & reslist,, "Unique Result"
End Sub
Function Unique(a)
Dim data List As Integer
Dim i%, n%
REM test to see if a is an array; if not, return it
If Not(IsArray(a)) Then
Unique = a
Exit Function
End If
For i=Lbound(a) To Ubound(a)
data( Cstr(a(i)) ) = i
Next
REM This takes the new list and puts it back into an array
n = 0
Redim newarray(0 To Ubound(a)-Lbound(a))
Forall z In data
newarray(n) = a(z)
n = n + 1
End Forall
Redim Preserve newarray(0 To n-1)
REM This returns the new array
Unique = newarray
End Function
zu finden in der megageilen Library (such mal nach unqiue):
http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/816d64935ee8842485256c680051b592?OpenDocument