Dim dlg As New OpenFileDialog dim f1,c1,r1 as string dlg.Filter= "Excel文件|*.xls" If dlg.ShowDialog = DialogResult.Ok Then f1 = dlg.FileName If f1<> " " then Dim Book As New XLS.Book(f1) Dim Sheet As XLS.Sheet = Book.Sheets(0) r1 = Sheet.Rows.Count c1 = Sheet.Cols.Count messagebox.show(r1) messagebox.show(c1) end if end if