Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
=Left([Example],Instr([Example],",")-1)
=Mid([Example],Instr([Example],",")+1)
aNames = Split(myName, ",")
firstName = aNames(0)
lastName = aNames(1)
Geoff:You can also use the Split function which will give you an array
Public Function ParseAttrib(strText As String, _
strAttrib As String, _
strDelimiter As String)
[green] '---------------------------------------------------------
' Procedure : ParseAttrib
' Author : Duane Hookom
' Date : 10/1/2010
' Purpose : Pull a single value from a multi-value string
' the strText must use = to match an attribute with its value
'
' Samples
' --------------------------------------------------------
' ParseAttrib("color=red;Age=50;Dog=False","Color",";")=red
' ParseAttrib("color=red;Age=50;Dog=False","dog",";")=False
'--------------------------------------------------------- [/green]
Dim arText() As String
Dim intI As Integer
On Error GoTo ParseAttrib_Error
arText() = Split(strText, strDelimiter)
For intI = 0 To UBound(arText)
If Split(arText(intI), "=")(0) = strAttrib Then
ParseAttrib = Split(arText(intI), "=")(1)
End If
Next
On Error GoTo 0
Exit Function
ParseAttrib_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ParseAttrib of Module basParseText"
End Function
Public Function ParseText(pstrText As String, intElement As Integer, _
pstrDelimiter As String) As String
Dim arText() As String
On Error GoTo ParseText_Error
arText() = Split(pstrText, pstrDelimiter)
ParseText = arText(intElement - 1)
ExitParseText:
On Error GoTo 0
Exit Function
ParseText_Error:
Select Case Err
Case 9 [green]'subscript out of range
'don't do anything[/green]
Case Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ParseText of Module basParseText"
End Select
Resume ExitParseText
End Function