Dim mydate As Date = Forms("余额导入").Controls("DateTimePicker1").Text
Dim ny As String = format( mydate,"yyyy-MM")
Dim Book As New XLS.Book(ProjectPath & "银行余额.xls")
For i As Integer = 0 To Book.Sheets.Count -1
Dim a As String = Book.Sheets(i).Name
If a = ny Then
' DataTables("余额导入").DeleteFor("[编号] is not null")
Dim mg As New Merger
mg.SourcePath = ProjectPath & "银行余额.xls"
mg.Format = "excel" '指定格式
mg.SourceTableName = "" & ny &"$" '指定要合并的表
mg.DataTableName = "余额导入" '指定接收数据的表
mg.Merge() '开始合并
DataTables("余额导入").Save()
Exit For
Else
Messagebox.show("需导入的数据不存在!","提示")
End If
Next