mel_flynn
May 12th, 2006, 06:40 AM
Hi all,
I want to import the contents of a text file into an Excel Sheet. I am using the following VBA code: Path = Workbooks("NITBSum_Macro.xls").Worksheets("Network").Cells(4, 2).Value
Workbooks.OpenText FileName:=Path & "JT_Insurance_Report.txt", Origin:= _
xlWindows, 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, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7 _
, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
(14, 1), Array(15, 1))
Cells(1, 1).Select
Selection.EntireRow.Insert
This is working fine for most text files, however I have one file that has more than 100,000 lines, which exceeds the maximum allowed 65,000 lines in an excel document.
So my question is:
1. How can I get it to automatically create a second excel file with the remaining contents of the text file? At the moment it just returns an error when it reaches 65,000 lines.
Thanks,
I want to import the contents of a text file into an Excel Sheet. I am using the following VBA code: Path = Workbooks("NITBSum_Macro.xls").Worksheets("Network").Cells(4, 2).Value
Workbooks.OpenText FileName:=Path & "JT_Insurance_Report.txt", Origin:= _
xlWindows, 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, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7 _
, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array _
(14, 1), Array(15, 1))
Cells(1, 1).Select
Selection.EntireRow.Insert
This is working fine for most text files, however I have one file that has more than 100,000 lines, which exceeds the maximum allowed 65,000 lines in an excel document.
So my question is:
1. How can I get it to automatically create a second excel file with the remaining contents of the text file? At the moment it just returns an error when it reaches 65,000 lines.
Thanks,