1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Sub CleanigQRstring()
Dim tonstring As String
tonstring = "Kit : 53367607-1 Référence SAP : PANEL ACCESS - ELV LE IML 136 LH G600 Tack Life (Heures) 167.18333333333232 Times Out : ...."
Debug.Print FindTextBetween(tonstring, "Kit :", "Référence SAP")
Debug.Print FindTextBetween(tonstring, "Référence SAP :", "Tack Life")
End Sub
Function FindTextBetween(AllText, StartText, EndText)
FindTextBetween = vbNullString
StartTextLocation = InStr(1, AllText, StartText, vbTextCompare) + Len(StartText)
EndTextLocation = InStr(StartTextLocation, AllText, EndText, vbTextCompare) - StartTextLocation
Debug.Print AllText
On Error Resume Next
FindTextBetween = Mid(AllText, StartTextLocation, EndTextLocation)
On Error GoTo 0
End Function |
Partager