-
excel
Hi everyone,
The following code is in vb.net which simply opens a new instance of excel and places data into the cells of the sheet of the excel.
Can someone please send me a C# version of this?
Thanks
Dim oExcel As New Excel.Application
Dim oWorkBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
private sub PopulateExcel()
Dim oRng As Excel.Range
oWorkBook = oExcel.Workbooks.Add
oSheet = oWorkBook.ActiveSheet
oExcel.Visible = True
With oSheet
.Range("A1").Value = "ID"
.Range("A1").Font.Bold = True
.Range("B1").Value = "First Name"
.Range("B1").Font.Bold = True
End With
end sub
-
Since I don't use C# for automating other applications, I can't convert it. However, you can use VB code in C#. The CLR (CORBA?) lets you write code in a .NET language, and use it in another .NET language. You should also read about this, as it can come in handy later.
Phreak