[CODE]
Dim objExcelFile As Excel.Application
Dim objWorkBook As Excel.Workbook
Dim objImportSheet As Excel.Worksheet
Private Sub Command1_Click()
'打开EXCEL文件
Set objExcelFile = New Excel.Application
objExcelFile.DisplayAlerts = False
Set objWorkBook = objExcelFile.Workbooks.Open("d:\11.xls")
Set objImportSheet = objWorkBook.Sheets(1)
cdblLastColNum = objImportSheet.UsedRange.Columns.Count
cdblLastRowNum = objImportSheet.UsedRange.Rows.Count
'打开记录集
Call OpenCon
'循环浏览EXCEL文件并将其中的数据导入到数据库中的ASTMB表中
For intCountI = 1 To 20
'For intCountI = 1 To 2365
For intCountL = 1 To 63
'If Trim$(objImportSheet.Cells(intCountI, intCountL).Value) = "" Then
'TempString = " "
'Else
TempString = objImportSheet.Cells(intCountI, intCountL).Value
Select Case intCountL
Case 1
company = TempString
Case 2
creator = TempString
……………………
'关闭打开的对象
mycon.Close
objExcelFile.Quit
Set objWorkBook = Nothing
Set objImportSheet = Nothing
Set objExcelFile = Nothing
MsgBox ("导入ASTMB表成功!")
[/CODE]