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
![[صورة مرفقة: s_1426dirl71.jpg]](https://1.top4top.net/s_1426dirl71.jpg)
![[صورة مرفقة: s_1426w9c0v2.jpg]](https://2.top4top.net/s_1426w9c0v2.jpg)
![[صورة مرفقة: s_1426g9uym3.jpg]](https://3.top4top.net/s_1426g9uym3.jpg)