27-11-19, 10:12 AM
الكود التالي يعمل معي في vb 6 لكن اريد ان اكتبه في vb 2012 ممكن احد يحوله لي
Dim xl As New Excel.Application
Dim xlw As Excel.Workbook
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Set xlw = xl.Workbooks.open(app.path & "\book1.xlsx")
xlw.sheets("sheet1").select()
TextBox1.Text = xlw.Application.cells(1, 1).value
TextBox2.Text = xlw.Application.cells(1, 2).value
TextBox3.Text = xlw.Application.cells(1, 3).value
xlw.close()
set xlw = Nothing
set xl = Nothing
End Sub
End Class
Dim xl As New Excel.Application
Dim xlw As Excel.Workbook
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Set xlw = xl.Workbooks.open(app.path & "\book1.xlsx")
xlw.sheets("sheet1").select()
TextBox1.Text = xlw.Application.cells(1, 1).value
TextBox2.Text = xlw.Application.cells(1, 2).value
TextBox3.Text = xlw.Application.cells(1, 3).value
xlw.close()
set xlw = Nothing
set xl = Nothing
End Sub
End Class