Public Sub Importdate(strCardNum As String)
Dim excel_app As Object
Dim excel_sheet As Object
Dim row As Long
Dim col As Long Dim strstr As String
Dim strFile As String
Dim i As Integer
On Error GoTo Err
With Me.CommonDialog1
.FileName = ""
.Filter = Me.Caption & "EXCEL数据源(*.xls)|*.xls"
.ShowOpen
If .FileName = "" Then Exit Sub
strFile = .FileName
End With
Set excel_app = CreateObject("Excel.Application")
excel_app.workbooks.Open FileName:=strFile
If val(excel_app.Application.Version) >= 8 Then
Set excel_sheet = excel_app.Activesheet
Else
Set excel_sheet = excel_app
End If
row = 2
Do
col = 1
Do
DoEvents
'----获得第1行第col列的值
Fieldname_T = get_midstr(Trim$(excel_sheet.cells(1, col)), "(", ")")
col = col + 1
If Trim$(excel_sheet.cells(1, col)) = "" Then Exit Do
Loop
row = row + 1
col = 1
If Trim$(excel_sheet.cells(row, 1)) = "" Then Exit Do
Loop
excel_app.activeworkbook.Save
excel_app.activeworkbook.Close False
excel_app.Quit
End Sub