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:
Dim exl As New Excel.Application
Dim exlWorkSheet As Excel.Worksheet
exl.Visible = True
exl.Workbooks.Open("C:\ta1.xlsx")
exlWorkSheet = exl.Worksheets(1)
exlWorkSheet.Cells(2, 6).Value = "Hello"
Second Code
vb Code:
Dim exl As New Excel.Application
Dim exlWorkSheet As Excel.Worksheet
exl.Workbooks.Add("C:\ta1.xlsx")
exlWorkSheet = exl.Worksheets(1)
exlWorkSheet.Range("a1").Value = "Hello"