vba unquote string code example
Example: vba unquote string
' Removes quotes or other character from string (first and last character)
Public Sub Unquote(ByRef pText As String, Optional ByVal pQuote As String = """")
If IsEmpty(pText) Then
Exit Sub
End If
If Len(pText) > 1 Then
If Left(pText, 1) = pQuote Then
pText = Right(pText, Len(pText) - 1)
End If
End If
If Len(pText) > 1 Then
If Right(pText, 1) = pQuote Then
pText = Left(pText, Len(pText) - 1)
End If
End If
End Sub