ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to programming Excel in C# (https://www.excelbanter.com/excel-programming/278861-how-programming-excel-c.html)

Weimin Zhang

how to programming Excel in C#
 
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


All times are GMT +1. The time now is 01:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com