I am trying to figure out how to import a tab delimited .txt file that will have quoted fields that will have CRs within them. Whenever I try to import, Excel breaks up the lines when it encounters a CR in the middle of a quoted field. I need the line to stay in tact. Any help is appreciated.
If I open the .txt file in notepad and select all and then copy it into Excel, I get what I want. The problem is when I open the file in Excel and try to use the delimiters and text qualifiers. That's when Excel splits quoted fields into different lines when it encounters CRs.
I have attached a sample input file and what the desired results should be. Notice that some of the cells have multiple lines in them.
Here is the code I was using to start with:
Workbooks.OpenText Filename:=InputFile, Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, 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)), TrailingMinusNumbers:=True
Rows("1:" & Cells(Rows.Count, 1).End(xlUp).Row).Select
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.Copy
ThisWorkbook.Activate
Range("A7").Select
ActiveSheet.Paste
Thanks in advance
Bookmarks