Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

195
Vistas
txt tab delimited with columns to xls convert macro problem

I have the next macro to convert txt with tab delimited columns to xlsx. For columns with short data in cells nor problem it does very good the macro. However with cells that has very long texts or maybe some special characters the macro trunks the data and is wrongly placed some information to column A or other places where it doesn’t correspond. Check photo check the text with red circles that text is from previous row and it was truncated and passed there in column A next row. If I drag and drop manually (not using the macro) that txt with tab delimited columns in excel is processed very good no matter the length of the cells or special characters. If I convert with the macro as you see in red circles is truncated text to other columns/rows it doesn’t correspond. What would be required to fix the script and avoid it truncates or destroy the text as seen in red circles.

Public Sub Read_TXT()
Dim Dir_p As String, File_to_Open As String
Dir_p = ActiveWorkbook.Path
File_to_Open = Dir(Dir_p & "\")
While File_to_Open <> ""
  If InStr(1, Right(File_to_Open, 3), "txt", vbTextCompare) <> 0 Then
    Workbooks.OpenText fileName:=Dir_p & "\" & File_to_Open, _
        Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
        Comma:=False, Space:=False, Other:=False, _
        TrailingMinusNumbers:=True
    ActiveWorkbook.SaveAs fileName:=Dir_p & "\" & Left(File_to_Open, Len(File_to_Open) - 3) & "xlsx" _
        , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWorkbook.Close
  End If
  File_to_Open = Dir
Wend
End Sub

enter image description here

Thank you

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda