how to programming Excel in C#

W

Weimin Zhang

Hi, following is the VBA code generated by Macro in Excel
XP (2002). What I would like to do is to incorporate the
same thing into C#, but I don't know how to pass the Array
() to C# in the Workbooks.OpenText() method. Can anyone
please help me on how to pass these parameters for this
method in C#? Thanks a lot!

Sub WMTest()
'
' WMTest Macro
' Macro recorded 10/6/2003 by WEIMIN ZHANG
'

'
Workbooks.OpenText
Filename:="C:\MMS\BatchPrint\dave.txt", Origin:=437, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False, Comma:=True _
, 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)), _
TrailingMinusNumbers:=True
ChDir "C:\MMS\BatchPrint"
ActiveWorkbook.SaveAs
Filename:="C:\MMS\BatchPrint\dave.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top