I have the following function to parse command line arguments in vb6
Private Function GetProcessParams() As Variant
Dim i As Integer
Dim result() As Variant
Select Case Command
Case "-all"
Set GetProcessParams = allProcess.Items
Exit Function
Case "-new"
For i = 0 To allProcess.Count
Dim tmp As TableInfo
Set tmp = allProcess(i)
If tmp.isNew Then
ReDim result(i + 1)
Set result(i) = tmp
End If
Next i
Set GetProcessParams = result
Exit Function
Case Else
Dim subset() As String
subset = Split(Command, ",")
ReDim result(UBound(subset))
Dim val As String
For i = 0 To UBound(subset)
If IsNumeric(subset(i)) Then
Set result(i) = allProcess(CInt(subset(i)))
End If
Next i
Set GetProcessParams = result
Exit Function
End Select
End Function
At runtime, it stops at line "Set GetProcessParams = result" in Case "-new" with message "Compile error: Object required"
What's wrong?