Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/05/2005, 04:05
sdemingo
 
Fecha de Ingreso: noviembre-2003
Ubicación: Madrid
Mensajes: 109
Antigüedad: 21 años, 6 meses
Puntos: 0
Que conste que tu txt está muy mal estructurado con tanta comilla.... pero en fin... dile a tu profe que la mitad de la nota es mía

Código:
Option Explicit

Dim ingenieros(0 To 2) As String

Private Sub Form_Load()

If LeerArchivo Then
    GenerarSalida
    MsgBox "Proceso de selección finalizado con éxito"
Else
    MsgBox "No hay candidatos que cumplan los requisitos solicitados"
End If
End

End Sub

Private Function LeerArchivo() As Boolean

Dim linea As String
Dim registro() As String
Dim indice As Integer

Open App.Path & "\Profesionales.txt" For Input As #1
indice = 0
LeerArchivo = False
Do Until EOF(1)
   Line Input #1, linea
   registro = Split(linea, ",", -1, vbBinaryCompare)
   If Trim(registro(3)) = """M""" And Trim(registro(4)) < 35 And Trim(registro(5)) = """Soltero""" Then
        ingenieros(indice) = Trim(registro(0)) & ", " & Trim(registro(1)) & ", " & Trim(registro(6))
        If indice < 2 Then
            indice = indice + 1
        Else
            LeerArchivo = True
            Exit Do
        End If
   End If
Loop
Close #1

End Function

Private Sub GenerarSalida()
    
    Dim i As Integer
    
    Open App.Path & "\Seleccionados.txt" For Output As #1
    For i = LBound(ingenieros) To UBound(ingenieros)
        Write #1, Replace(ingenieros(i), """", "")
    Next i
    Close #1
    
End Sub
__________________
Lo importante no es saber, sino tener el teléfono del que sabe :risa: