Deseamos crear una macro que importe archivos tipo texto y
los inserte en una sola hoja de trabajo, de manera
consecutiva. Los archivos deben ser importados en series
de 20 numeros subsecuentes.
Los archivos de origen ya tienen un nombre consecutivo,
compuesto de una primera parte con texto y una segunda
parte numerica, y todos ellos se localizan en una misma
carpeta.
Anexamos ejemplo de la macro en donde buscamos incrementar
progresivamente el numero de archivo por abrir. lo ideal
es incluir un (For Next)que incremente el consecutivo pero
no sabemos como es la sintaxis
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 21/01/2004 by JRamosM
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;D:\Documents and Settings\ATTO9467.PINS" _
, Destination:=Range("A1"))
.Name = "ATTO9467"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 2, 1,
1, 1, 1)
.TextFileFixedColumnWidths = Array(30, 8, 6, 9,
20, 32, 23, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Selection.End(xlDown).Select
Range("A2501").Select
End Sub
Leer las respuestas