Function GetCommandLine(Optional MaxArgs) Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs If IsMissing(MaxArgs) Then MaxArgs = 10 ReDim ArgArray(MaxArgs) NumArgs = 0: InArg = False CmdLine = Command() CmdLnLen = Len(CmdLine) For I = 1 To CmdLnLen C = Mid(CmdLine, I, 1) If (C <> " " And C <> vbTab) Then If Not InArg Then If NumArgs = MaxArgs Then Exit For NumArgs = NumArgs + 1 InArg = True End If ArgArray(NumArgs) = ArgArray(NumArgs) & C Else InArg = False End If Next I ReDim Preserve ArgArray(NumArgs) GetCommandLine = ArgArray() End Function
Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
If IsMissing(MaxArgs) Then MaxArgs = 10
ReDim ArgArray(MaxArgs)
NumArgs = 0: InArg = False
CmdLine = Command()
CmdLnLen = Len(CmdLine)
For I = 1 To CmdLnLen
C = Mid(CmdLine, I, 1)
If (C <> " " And C <> vbTab) Then
If Not InArg Then
If NumArgs = MaxArgs Then Exit For
NumArgs = NumArgs + 1
InArg = True
End If
ArgArray(NumArgs) = ArgArray(NumArgs) & C
Else
InArg = False
End If
Next I
ReDim Preserve ArgArray(NumArgs)
GetCommandLine = ArgArray()
End Function