Click here to Skip to main content
15,921,169 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Browse Pin
united1828-Feb-06 13:59
united1828-Feb-06 13:59 
GeneralRe: Browse Pin
Steve Pullan28-Feb-06 14:11
Steve Pullan28-Feb-06 14:11 
Questionkilling a class instance Pin
blucas200528-Feb-06 12:15
blucas200528-Feb-06 12:15 
AnswerRe: killing a class instance Pin
Steve Pullan28-Feb-06 13:21
Steve Pullan28-Feb-06 13:21 
QuestionMappoint Pin
UniBond28-Feb-06 12:11
UniBond28-Feb-06 12:11 
Question[vb.net] xml serialization of a dictionary obj Pin
fuel2run28-Feb-06 10:30
fuel2run28-Feb-06 10:30 
QuestionLast node in a treeview Pin
cosma21728-Feb-06 7:21
cosma21728-Feb-06 7:21 
QuestionExcel VBA to VB.NET conversion Pin
KreativeKai28-Feb-06 5:38
professionalKreativeKai28-Feb-06 5:38 
I have the following code in Excel VBA that I'm trying to convert to VB.NET:

Workbooks.OpenText(Filename:= _<br />
"C:\temp.txt", Origin:=437, StartRow:= _<br />
1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _<br />
ConsecutiveDelimiter:=False, TAB:=False, Semicolon:=False, Comma:=True _<br />
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2), _<br />
Array(3, 2), Array(4, 1)), TrailingMinusNumbers:=True)


I've converted everything except the array portion (arrColumnDataType shown below with ???). I'm having a problem coming up with the proper array in VB.NET to put in this code:

Dim xlApp As New Excel.Application<br />
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)<br />
xlApp.Application.Visible = True<br />
Dim strReportName As String = "C:\temp.txt"<br />
<br />
???  How do I define arrColumnDataType  ???<br />
<br />
xlApp.Workbooks.OpenText(strReportName, 437, 1, _<br />
Excel.XlTextParsingType.xlDelimited, _<br />
Excel.XlTextQualifier.xlTextQualifierDoubleQuote, False, False, False, _<br />
True, False, False, False, arrColumnDataType, , , , , True)


I know that the array is defined as (column number, format) where format is:
Excel.XlColumnDataType.xlGeneralFormat = 1
Excel.XlColumnDataType.xlTextFormat = 2
Excel.XlColumnDataType.xlMDYFormat = 3
Excel.XlColumnDataType.xlDMYFormat = 4
Excel.XlColumnDataType.xlYMDFormat = 5
Excel.XlColumnDataType.xlMYDFormat = 6
Excel.XlColumnDataType.xlDYMFormat = 7
Excel.XlColumnDataType.xlYDMFormat = 8
Excel.XlColumnDataType.xlSkipColumn = 9

I just can't seem to get a proper array setup that the compiler likes. Does anyone have a suggestion? Has anyone coded this type of project with success. I'm using VS 2005, but I just upgraded about two weeks ago. Is there an easier way in 2.0? Thanks Confused | :confused:

Lost in the vast sea of .NET
AnswerRe: Excel VBA to VB.NET conversion Pin
KreativeKai1-Mar-06 8:55
professionalKreativeKai1-Mar-06 8:55 
QuestionHow to export xls file (excel) to dbf file (table of foxpro) using vb.net Pin
kucongtu28-Feb-06 4:54
kucongtu28-Feb-06 4:54 
Questionvisual basic trackbar Pin
whitkid28-Feb-06 4:05
whitkid28-Feb-06 4:05 
QuestionSystem.IO.IOException: Bad file name or number Pin
pravinkgarg28-Feb-06 3:46
pravinkgarg28-Feb-06 3:46 
AnswerRe: System.IO.IOException: Bad file name or number Pin
Steve Pullan28-Feb-06 11:06
Steve Pullan28-Feb-06 11:06 
GeneralRe: System.IO.IOException: Bad file name or number Pin
pravinkgarg28-Feb-06 23:18
pravinkgarg28-Feb-06 23:18 
QuestionPLEASE HELP!!! VB Database Connection Pin
ensuvari28-Feb-06 3:29
ensuvari28-Feb-06 3:29 
GeneralRe: PLEASE HELP!!! VB Database Connection Pin
Tim Carmichael28-Feb-06 4:39
Tim Carmichael28-Feb-06 4:39 
GeneralRe: PLEASE HELP!!! VB Database Connection Pin
ensuvari1-Mar-06 2:37
ensuvari1-Mar-06 2:37 
QuestionTreeview problem in vb.net Pin
pankajgarg1228-Feb-06 3:09
pankajgarg1228-Feb-06 3:09 
Questiondatagrid and vertical gridlines Pin
JerryMcguire28-Feb-06 1:28
JerryMcguire28-Feb-06 1:28 
AnswerRe: datagrid and vertical gridlines Pin
JerryMcguire28-Feb-06 1:57
JerryMcguire28-Feb-06 1:57 
QuestionSNA Server Pin
illusionFinder28-Feb-06 1:03
illusionFinder28-Feb-06 1:03 
QuestionData Binding property in vb.net Pin
pankajgarg1228-Feb-06 0:55
pankajgarg1228-Feb-06 0:55 
QuestionDatabase Problems in vb.net Pin
pankajgarg1228-Feb-06 0:40
pankajgarg1228-Feb-06 0:40 
QuestionHow to create a class inherited from StringConverter by Reflection.Emit (Dynamically) Pin
Mohamed Ali Jinnah27-Feb-06 22:58
Mohamed Ali Jinnah27-Feb-06 22:58 
Questionto invoke word,excel.... in vb.net Pin
thepityone27-Feb-06 22:32
thepityone27-Feb-06 22:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.