在ACCESS窗体中用VB导入可选EXCEL文件
在ACCESS的窗体中生成按钮,用VB控制导入EXCEL表的内容到ACCESS中已有的表“全天”中,但老是出错“编译错误,用户定义类型未定义”不知错在哪里,请高手指点!Option Compare Database
Sub Command54_Click()
Dim dlgOpen As FileDialog
Dim datafile As Variant
Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)
With dlgOpen
If .Show = -1 Then
For Each datafile In .SelectedItems
DoCmd.TransferSpreadSheet acImport, , "全天", datafile, -1
Next datafile
Else
Set dlgOpen = Nothing
End If
End With
End Sub