Sub buscaInclina(Optional ByVal bs As Integer)
Dim a As Long
Dim b As String
b = "I"
If Len(b) Then
a = InStr(bs + 1, Txt.Text, b)
If a > 0 Then
cont = cont + 1
Txt.SelStart = a + 1
Txt.SelLength = 4
Txt.SetFocus
Datos(0, dataI) = Txt.SelText
Else
MsgBox "No se encuentra: " & Chr$(13) & b, vbDefaultButton1, """"
End If
End If
dataI = dataI + 1
If cont <= 1 Then
buscaInclina (Txt.SelStart + 1)
End If
If cont > 1 Then
If a = 0 Then GoTo Luz 'This is the end of the looking,then pass it to the next variable L
buscaInclina (Txt.SelStart + 1)
End If
Luz:
dataAux = dataI
Call buscaLuz
Lista.SetFocus
End Sub
Sub buscaLuz(Optional ByVal bs As Integer)
Dim a As Long
Dim b As String
b = "L"
If Len(b) Then
a = InStr(bs + 1, Txt.Text, b)
If a > 0 Then
cont = cont + 1
Txt.SelStart = a + 1
Txt.SelLength = 4
Txt.SetFocus
Datos(1, dataL) = Txt.SelText
Else
MsgBox "No se encuentra: " & Chr$(13) & b, vbDefaultButton1, """"
End If
End If
dataL = dataL + 1
If cont <= 1 Then
buscaLuz (Txt.SelStart + 1)
End If
If cont > 1 Then
If a = 0 Then GoTo Temp 'This is the end of the looking,then pass it to the next variable T
buscaLuz (Txt.SelStart + 1)
End If
Temp:
dataAux = dataL
Call buscaTemp
Lista.SetFocus
End Sub
Sub buscaTemp(Optional ByVal bs As Integer)
Dim a As Long
Dim b As String
b = "T"
If Len(b) Then
a = InStr(bs + 1, Txt.Text, b)
If a > 0 Then
cont = cont + 1
Txt.SelStart = a + 1
Txt.SelLength = 4
Txt.SetFocus
Datos(2, dataT) = Txt.SelText
Else
MsgBox "No se encuentra: " & Chr$(13) & b, vbDefaultButton1, """"
End If
End If
dataT = dataT + 1
If cont <= 1 Then
buscaTemp (Txt.SelStart + 1)
End If
If cont > 1 Then
If a = 0 Then GoTo Pres 'This is the end of the looking,then pass it to the next variable P
buscaTemp (Txt.SelStart + 1)
End If
Pres:
dataAux = dataT
Call buscaPres
Lista.SetFocus
End Sub
Function buscaPres(Optional ByVal bs As Integer)
Dim a As Long
Dim b As String
b = "P"
If Len(b) Then
a = InStr(bs + 1, Txt.Text, b)
If a > 0 Then
cont = cont + 1
Txt.SelStart = a + 1 '-1
Txt.SelLength = 4
Txt.SetFocus
Datos(3, dataP) = Txt.SelText
Else
MsgBox "No se encuentra: " & Chr$(13) & b, vbDefaultButton1, """"
End If
End If
dataP = dataP + 1
If cont <= 1 Then
buscaPres (Txt.SelStart + 1)
End If
If cont > 1 Then
dataAux = dataP
If a = 0 Then
GoTo Fin
End If
buscaPres (Txt.SelStart + 1)
End If
Fin:
Lista.SetFocus
End Function
‘This is the section where I’m having problems, it stay like a Loop and I don’t want that. What I need is when the message from the Function buscaPres appears, the Function have to end, ‘cause otherwise the message appears as many times as you press Enter or the OK button. That the reason I used the label Fin, but it didn’t chance at all. I hope someone can help with this. What I’m trying to do is to read a text file ( *.txt ), then print it in a textbox in order to read it, after this I have to identify 4 different values. I’m writing a letter before each value, so I read the first letter (identifier) for example in buscaInclina I look for a “I” (b = "I") and then the next 4 characters in this case numbers are copy to arrangement.
This is the way I’m saving my data base (the file text that I must read in order to identify my 4 different variables: I, L, T, P):
I 1E-10 I've to copy this value,but only this value whitout the letter. Eg.:1E-10 and so on...
L 1E-10
T 38.61
P 1E-10
I 1E-10
L 1E-10
T 38.17
P 1E-10
I 1E-10
L 1E-10
T 39.49
P 1E-10
I 1E-10
L 1E-10
T 38.28
P 1E-10
Then I saved this 4 different values in another text file for each one ( 4 text files), and finally I have to plot this information as an animation. But my first problem is how to end the Function that I’m using to identify my different values, that my critical problem. Thanks a lot any help is welcome… =)
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).