DifString




Public Function Difference(First As String, Second As String) As String
Dim Overlap As String
Dim i, Start As Long
'Isolate largest common substring

For i = Len(First) To 1 Step -1
Overlap = Right(First, i)
Start = InStr(1, Second, GrayArea, vbTextCompare)
If Start <> 0 Then Exit For
Next i
If Start <> 0 Then
Difference = Mid(Second, (Len(Overlap) + 1), _
(Len(Second) - Len(Overlap)))
Else 'No common overlapping substring
Difference = Second
End If
End Function











( difstring.html )- by Paolo Puglisi - Modifica del 17/12/2023