I'm using this code, and its working.
But my text file is to long, so I can't see all the text.
Its like the height of the row reached the limit.
What can I do?
Maybe copy one row from the text file to one row in the Excel worksheet.
Sub CopyTextFile()
Dim oFso : Set oFso = CreateObject("Scripting.FileSystemObject")
Dim oFile : Set oFile = oFso.OpenTextFile(""L:\00010\COMPANY.bat"", 1)
Dim sText
sText = oFile.ReadAll
oFile.Close
ThisWorkbook.Sheets("Text file").Range("A1").Value = sText
End Sub
Sub Macro1()
Dim comp, path1 As String
comp = "COMPANY"
path1 = "TEXT;L:\00010\COMPANY.bat"
With ActiveSheet.QueryTables.Add(Connection:=path1, _
Destination:=Range("C1"))
.Name = comp
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub