Boa Tarde
Caros,
Gostaria de Saber é possível exportar dados de um arquivo txt para o excel, porém não quero que seja importado o "Cabeçalho" dentro desse arquivo.
Acredito que deveria contar as linhas desse arquivo txt para assim depois importar para o Excel porém não tenho idéia de como fazer isso.
Alguém pode me ajudar por favor!!!
Estou enviando o anexo de exemplo
Desde já agradeço!
Atenciosamente
Douglas
Vídeo recomendado
https://youtu.be/diWPPPhW-9E
https://youtu.be/diWPPPhW-9E
Copiar dados de arquivo TXT (a partir da 5ª linha)
Copiar dados de arquivo TXT (a partir da 5ª linha)
- Anexos
-
- Base teste.zip
- (496 Bytes) Baixado 211 vezes
Re: Copiar dados de arquivo TXT (a partir da 5ª linha)
DJ, boa tarde!
Veja se atende:
Sub import()
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\"Coloque o caminho aqui", Destination:=Range("$A$1"))
.Name = "Base teste"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 932
.TextFileStartRow = 5
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=-15
End Sub
Espero ter ajudado!
Magushi
Veja se atende:
Sub import()
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\"Coloque o caminho aqui", Destination:=Range("$A$1"))
.Name = "Base teste"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 932
.TextFileStartRow = 5
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=-15
End Sub
Espero ter ajudado!
Magushi