我tryng运行在访问这个模块:
I am tryng to run this module on Access:
Public Sub Retriever_P(path)
DoCmd.TransferSpreadsheet acImport, 10, "Product_Details", path, True, ""
End Sub
从这个VBA code在Excel
From this VBA code in Excel
Private Sub CommandButton210_Click()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
Dim Target As String: Target = ThisWorkbook.Sheets("CODE").Cells(8, 4).Value
Dim path As String: path = ThisWorkbook.Sheets("CODE").Cells(5, 13).Value
appAccess.OpenCurrentDatabase Target
appAccess.Visible = True
appAccess.DoCmd.SetWarnings False
appAccess.UserControl = True
appAccess.DoCmd.OpenQuery "Clean Product_Details"
appAccess.Run "Retriever_P", path
appAccess.CloseCurrentDatabase
End Sub
不过,我得到这个错误2517,微软Access无法找到程序Retriever_P
But I get this Error 2517, "Microsoft Access cannot find the procedure "Retriever_P"
Excel的code是一个更大的宏,创建了一个数据库的一部分,然后将其发送到接入。 任何想法?
The Excel code is part of a bigger macro that creates a DB and then sends it to access. Any Ideas?
感谢你在前进!
我已经找到了解决方案:问题在于子的名字是一样的模块名称。我不知道它必须是不同的,但我希望有人会发现这很有用! 感谢所有的答案家伙!
I have found the solution: the problem was that the sub name was the same as the module name. I didn't know it had to be different, but I hope someone will find this useful! Thanks for all the answers guys!