Imports Microsoft.Office.Interop.Excel
Public Class Form1
Dim data_arr() As String
Sub excelConnection()
Dim newsht As Worksheet
Dim excelpath As String
Dim shtname As String
Dim wkbook As Workbook
Dim excelapp As Application
Dim teststr As String
Dim totalcells As Integer
excelapp = CreateObject("Excel.Application")
shtname = "testsht.xlsx"
excelpath = "D:\Backup\桌面\intentory_end_of_2016\"
wkbook = excelapp.Workbooks.Open(excelpath & shtname)
excelapp.Visible = False
newsht = wkbook.Sheets(1)
teststr = newsht.Range("A1").Text
totalcells = getlastcell(newsht)
'fill the array
ReDim data_arr(totalcells)
Dim i_this As Integer
For i_this = 1 To UBound(data_arr)
data_arr(i_this - 1) = newsht.Range("A" & i_this + 1).Text
Next
Me.Label1.Text = totalcells
Me.L