
19/01/2010, 08:47
|
| | Fecha de Ingreso: enero-2007 Ubicación: 9 de julio
Mensajes: 111
Antigüedad: 18 años, 3 meses Puntos: 2 | |
Respuesta: funcion Instr Hola. Mira lo que se me ocurre es hacerlo en dos partes. Una que te busca el ultimo separador y la otra que asigna.
espero te sirva
Código:
Private Sub Command1_Click()
Dim LoteNew As String, Aux As Integer
'leo el dato (en este caso lo asigne, pero se supone lo debes leer del fichero)
LoteNew = "!WV63|WW60|WW61|WW68|GT00|LX021|3|0|928"
'Busco la posicion donde esta el ultimo separador |
Aux = MyInstrLast(LoteNew, "|")
'recorto
LoteNew = Mid(LoteNew, Aux + 1, Len(LoteNew) - Aux)
End Sub
Private Function MyInstrLast(ByVal pstrText As String, ByVal pstrSearch As String) As Integer
Dim pos As Integer, Aux As Integer, ctrl1 As Integer
pos = 0
Do
Aux = InStr(pos + 1, UCase(pstrText), UCase(pstrSearch))
If Aux <> 0 Then pos = Aux
Loop Until Aux = 0
MyInstrLast = pos
End Function
|