Se per testo ti riferisci ad un file di testo è possibile che contenga i caratteri vbCrLf : carriage return and line feed Chr(13) + Chr(10), che rappresenta il ritorno a capo in VB.
Ci sono diversi metodi per togliere i caratteri vbCrLf uno potrebbe essere:
codice:
testo = "Ciao" & vbCrLf
X = InStr(1, testo, Chr(10), vbTextCompare)
If X = Len(testo) Then
'questo caso testo = "Ciao" & vbCrLf
testo1 = Mid(testo, 1, X - 2)
ElseIf X = 2 Then
'questo caso testo = vbCrLf & "Ciao"
testo1 = Mid(testo, X + 1)
Else
'questo caso testo = "Ciao" & vbCrLf & "Ciao"
testo1 = Mid(testo, 1, X - 2) & Mid(testo, X + 1)
End If
PS: Scusa Alka