Results 1 to 2 of 2

Thread: excel

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    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

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    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
    Last edited by «°°phReAk°°»; Apr 12th, 2004 at 02:47 PM.

    Visual Studio 6, Visual Studio.NET 2005, MASM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width