我尝试使用select语句通过宏获取列中的唯一值。但是执行select语句会引发错误。更糟糕的是,错误对话框没有显示错误消息:
我使用的代码是:
Sub DataFilter()
Dim adoConnection As Object
Dim rcdSource As Object
Dim strSource As String, srcName As String
Dim lngLoop As Long
MsgBox "Hailo"
Set adoConnection = CreateObject("ADODB.Connection")
Set rcdSource = CreateObject("ADODB.Recordset")
SourceWbk = ActiveWorkbook.Name
strSource = ActiveWorkbook.FullName
MsgBox "strSource is " & strSource
adoConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & strSource & ";Extended Properties=""Excel 12.0 XML;HDR=YES"";"
rcdSource.Open "SELECT DISTINCT [Movie Name] FROM [MyExcel_File$] "
End Sub
有谁能告诉我我做错了什么?