Problema con fichero de txt en vb
Publicado por jtaibo (1 intervención) el 07/06/2004 14:32:22
Tengo el siguiente código:
Open sRuta For Input As #30
Open App.Path & "\n.txt" For Append As #31
Debug.Print sRuta
iNulinea = 0
Do While Not EOF(30)
Line Input #30, sLineaTexto
iNulinea = iNulinea + 1
'tengo que recoger el nif
iposIni = Buscar(1, sLineaTexto, "§", 3)
iposFi = Buscar(1, sLineaTexto, "§", 4)
sNif = Mid(sLineaTexto, iposIni + 1, (iposFi - iposIni - 1))
iposIni = Buscar(1, sLineaTexto, "§", 2)
iposFi = Buscar(1, sLineaTexto, "§", 3)
sTitular = Mid(sLineaTexto, iposIni + 1, (iposFi - iposIni - 1))
For iposIni = 1 To UBound(iNulin)
If iNulinea = iNulin(iposIni) Then
'escribir en n.txt
Write #31, sNif, sTitular
Print #31, "jojioij"
End If
Next iposIni
Loop
Close #30
Close #31
el fichero que corresponde con 30 existe y tiene datos
cuando llego a write las variables llevan datos, acaba
el write sigue con el print pero en el fichero n.txt no escribe nada sin dar ningún tipo de error, sólo existe un fichero n.txt no estoy escribiendo en otro...
No se porque no me escribe el fichero n.txt.
Open sRuta For Input As #30
Open App.Path & "\n.txt" For Append As #31
Debug.Print sRuta
iNulinea = 0
Do While Not EOF(30)
Line Input #30, sLineaTexto
iNulinea = iNulinea + 1
'tengo que recoger el nif
iposIni = Buscar(1, sLineaTexto, "§", 3)
iposFi = Buscar(1, sLineaTexto, "§", 4)
sNif = Mid(sLineaTexto, iposIni + 1, (iposFi - iposIni - 1))
iposIni = Buscar(1, sLineaTexto, "§", 2)
iposFi = Buscar(1, sLineaTexto, "§", 3)
sTitular = Mid(sLineaTexto, iposIni + 1, (iposFi - iposIni - 1))
For iposIni = 1 To UBound(iNulin)
If iNulinea = iNulin(iposIni) Then
'escribir en n.txt
Write #31, sNif, sTitular
Print #31, "jojioij"
End If
Next iposIni
Loop
Close #30
Close #31
el fichero que corresponde con 30 existe y tiene datos
cuando llego a write las variables llevan datos, acaba
el write sigue con el print pero en el fichero n.txt no escribe nada sin dar ningún tipo de error, sólo existe un fichero n.txt no estoy escribiendo en otro...
No se porque no me escribe el fichero n.txt.
Valora esta pregunta


0