04-12-20, 11:46 PM
الحمد لله والشكر لله رب العالمين .
تصحيح صغير على كود الفتح في حال لم تختر ملف من سيعطيك خطأ من السرعة لم انتبه في شرط If open.ShowDialog Then نسيت ان اكتب تتمة الشرط :
تصحيح صغير على كود الفتح في حال لم تختر ملف من سيعطيك خطأ من السرعة لم انتبه في شرط If open.ShowDialog Then نسيت ان اكتب تتمة الشرط :
PHP كود :
Dim open As New OpenFileDialog
open.Filter = "Excel File |*.Xls;*.Xlsx"
If open.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim oExcel As Object = CreateObject("Excel.Application")
Dim oBook As Object = oExcel.Workbooks.Open(open.FileName) ''"e:\1.xlsx"
Dim oSheet As Object = oBook.Worksheets(1)
Dim i As Integer
Dim cell As String
Dim cell1 As String
For i = 0 To AscW(ListBox1.Items.Count.ToString()(i = i + 1)) - 1
cell = "A" & Convert.ToString(i + 1)
cell1 = "B" & Convert.ToString(i + 1)
cell = oSheet.Range(cell).Value
cell1 = oSheet.Range(cell1).Value
If cell = "" Then
Exit For
Else
ListBox1.Items.Add(cell & " | " & cell1)
End If
Next
oExcel.Quit()
End If
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
