Import Textfile to Excel

Matrixmatrix

Member
Joined
Sep 30, 2004
Messages
7
Programming Experience
1-3
Hello,... I'm new here.....
Is there a way to import a textfile to excel with fieldinfos (fieldinfo=Text)???

I'm now trying it for 2 days but i always get an error message....

Code sample from VBA:
Workbooks.OpenText Filename:= _
"file", Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, _
Comma:=False, Space:=False, Other:=False,


How can i specify this in .net?????
------------------------------------------------------------------
FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 2), Array(6, 1), Array(7, 2), Array(8, 1), _
Array(9, 1))

------------------------------------------------------------------

Trying to make an array fails.....

Please, help me....?
 
This works for me. I have 17 columns, I want 1,3,4,6,8 to be text and the rest General.
Dennis Mello

Imports Excel.XlColumnDataType


Dim columnarray(,) As Integer = New Integer(,) {{1, xlTextFormat}, {2, xlGeneralFormat}, {3, xlTextFormat}, _
{4, xlTextFormat}, {5, xlGeneralFormat}, {6, xlTextFormat}, {7, xlGeneralFormat}, {8, xlTextFormat}, {9, xlGeneralFormat}, {10, xlGeneralFormat}, {11, xlGeneralFormat}, {12, xlGeneralFormat}, _
{13, xlGeneralFormat}, {14, xlGeneralFormat}, {15, xlGeneralFormat}, {16, xlGeneralFormat}, {17, xlGeneralFormat}}

xl.Workbooks.OpenText(Filename:= _
"C:\AutoSummaryReport\Datafiles\SummaryReport.txt", Origin:=437, StartRow:= _
1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
Space:=False, Other:=False, FieldInfo:=columnarray, TrailingMinusNumbers:=True)
 
Back
Top