Results 1 to 1 of 1

Thread: Print data from my project to Excel file Problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    142

    Angry Print data from my project to Excel file Problem

    I'm going to crazy
    I'm using vb.net 2008 - Ms excel 2007
    I'm trying to export data from my project to excel file called ta1 in "C" hard
    The first code to open the file and print data to it. it worked with me very well
    The second code is to print the data when the file it opened. It didn't work with me
    Can you help ?

    FirstCode
    vb Code:
    1. Dim exl As New Excel.Application
    2.  Dim exlWorkSheet As Excel.Worksheet
    3. exl.Visible = True
    4. exl.Workbooks.Open("C:\ta1.xlsx")
    5. exlWorkSheet = exl.Worksheets(1)
    6.  exlWorkSheet.Cells(2, 6).Value = "Hello"

    Second Code
    vb Code:
    1. Dim exl As New Excel.Application
    2.  Dim exlWorkSheet As Excel.Worksheet
    3. exl.Workbooks.Add("C:\ta1.xlsx")
    4. exlWorkSheet = exl.Worksheets(1)
    5. exlWorkSheet.Range("a1").Value = "Hello"
    Last edited by mangore; Dec 1st, 2011 at 04:58 PM.

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