SwitchValue



Private mstrCmdLineAs String'Holds the command line arguments

Public Sub Main()
'Load Command Line Arguments

mstrCmdLine = Command
End Sub

Private Function GetSwitchValue(ByVal Switch As String, _
Optional ByVal Delimiter As String = " ", _
Optional ByVal DefaultValue As String = "") As String

Dim strResults()As String
Dim lngLoop As Long
Dim lngUpperAs Long
Dim strResultAs String

On Error Goto GetSwitchValue_Error

strResult = DefaultValue
strResults = Split(mstrCmdLine, Delimiter)
lngUpper = UBound(strResults)

If lngUpper < 1 Then Goto GetSwitchValue_Exit

For lngLoop = 0 To lngUpper - 1
If strResults(lngLoop) = Switch Then
strResult = strResults(lngLoop + 1)
Exit For
End If
Next lngLoop

Goto GetSwitchValue_Exit

GetSwitchValue_Error:

'Write To Log File

'WriteToLog "GetSwitchValue_Error: " & Err.Number & " " & Err.Description

Err.Clear
GetSwitchValue_Exit:
On Error Goto 0
GetSwitchValue = strResult
End Function

(switchvalue.html)- by Paolo Puglisi - Modifica del 25/3/2019