GRCS Kal-el... perdón KL....
Lo integre en mi macro pero no hace lo que se supone debe hacer...Insertar
una nueva hoja con el reto de las lineas.... que sucede?? este es el código..
Sub LargeFileImport()
'Dimension Variables
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
Dim dia As String
Dim mes As String
Dim anio As String
Dim c As String
dia = Format(Date, "dd")
mes = Format(Date, "mm")
anio = Format(Date, "yy")
mescomp = Format(Date, "mmmm")
c = InputBox("Indica el ciclo que validas a 2 digitos", "VALIDACION DE
CICLOS", "00")
Workbooks.OpenText FileName:="C:\revenue\datos_salida\DetC" + c + "" +
mes + "" + anio + ".txt", _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=False, _
Comma:=False, Space:=False, Other:=True, OtherChar:="|", FieldInfo:= _
Array(Array(1, 1), Array(2, 2), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1), Array(7 _
, 1), Array(8, 1), Array(9, 1), Array(10, 2), Array(11, 4),
Array(12, 1), Array(13, 1), Array _
(14, 1), Array(15, 1), Array(16, 1), Array(17, 1)),
TrailingMinusNumbers:=True
'Ask User for File's Name
'FileName = InputBox("Please enter the Text File's name, e.g. test.txt")
'Check for no entry
If FileName = "" Then End
'Get Next Available File Handle Number
FileNum = FreeFile()
'Open Text File For Input
Open FileName For Input As #FileNum
'Turn Screen Updating Off
'Application.ScreenUpdating = False
'Create A New WorkBook With One Worksheet In It
Workbooks.Add template:=xlWorksheet
'Set The Counter to 1
Counter = 1
'Loop Until the End Of File Is Reached
Do While Seek(FileNum) <= LOF(FileNum)
'Display Importing Row Number On Status Bar
Application.StatusBar = "Importing Row " & _
Counter & " of text file " & FileName
'Store One Line Of Text From File To Variable
Line Input #FileNum, ResultStr
'Store Variable Data Into Active Cell
If Left(ResultStr, 1) = "=" Then
ActiveCell.Value = "'" & ResultStr
Else
ActiveCell.Value = ResultStr
End If
'For Excel versions before Excel 97, change 65536 to 16384
If ActiveCell.Row = 65536 Then
'If On The Last Row Then Add A New Sheet
ActiveWorkbook.Sheets.Add
Else
'If Not The Last Row Then Go One Cell Down
ActiveCell.Offset(1, 0).Select
End If
'Increment the Counter By 1
Counter = Counter + 1
'Start Again At Top Of 'Do While' Statement
Loop
'Close The Open Text File
Close
'Remove Message From Status Bar
Application.StatusBar = False
End Sub
Post by KLHola Marvin,
http://support.microsoft.com/kb/120596/es
--
Saludos,
KL
Post by MarvinQue tal Grupo, Alguien sabe Como puedo yo saber cuantos registros (lineas)
tiene un archivo TXT???
El punto es que proceso contantemente archivos TXT con 50 mil, 60 mil y
hasta 70 u 80 mil lineas, por ende mi marco sólo procesará 65535 lineas,
existe alguna forma por código (vb) en donde yo pueda saber que se esta
superando este limite y de igual manera (por codigo) dividir este archivo en
2 HOJAS y correr el proceso 2 veces, en HOJA1 y HOJA2.....
GRCS