With a macro that I made I can perfectly pass a txt to excel from a route of choice. The problem arises that within the EOF function to get to the end of the txt I know only two instructions Line input and Input. Both read me line by line txt and I want you to read me word by word to compare them with data found in an excel.
Try to comment the code as much as possible so that it would be understood
Sub leerArchivoTextoCondicional()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim archivo As String 'ruta y nombre del archivo
Dim buscar As String 'palabra a buscar dentro del texto
Dim texto As String 'línea de texto a leer
Dim nLinea As Integer 'número de línea leída
Dim fila As Integer
Dim wb As Workbook
Dim ws As Worksheet
Dim libro As String
Dim cuit As String
libro = "Cruces" & ".xls"
tmp = ThisWorkbook.ActiveSheet.DropDowns("Drop Down 8").List (ActiveSheet.DropDowns("Drop Down 8").ListIndex)
tmp2 = Left(tmp, 4)
'Abrir el archivo
archivo = "C:\Users\rnovas002\Desktop\Shotting stars.txt"
numerodearchivo = FreeFile ' el freefile busca numero libre de archivo
Open archivo For Input As #numerodearchivo 'leer un archivo de texto por el canal #1
cuit = ThisWorkbook.Sheets("Cartera 1").Range("d16").Value
flag = 0
nLinea = 1
'Leer y procesar el contenido del archivo
While Not EOF(nLinea) 'la función EOF regresa verdadero al llegar al final del archivo
Input #numerodearchivo, texto 'lee cada una de las líneas del archivo y las almacena en la variable texto (aca esta el porblema)
If InStr(1, texto, cuit) > 0 Then 'buscar la palabra en la línea del texto leída
ActiveWorkbook.Sheets("Cartera 1").Range("d16").Offset(0, 1).Value = ChrW(&H2713)
End If
If InStr(1, texto, tmp2) > 0 Then
activeworbook.Sheets("Cartera 1").Range("j28").Value = ChrW(&H2713)
End If
Wend
Seek nLinea, 1 'vuelve a la primera linea
'Cerrar el archivo de entrada
Close #1
ThisWorkbook.Sheets("Cartera 1").Delete
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub