Python脚本打开MS访问并运行宏,找不到文件错误
我有与
我使用完全相同的代码,但使用我的访问文件和宏名称,使用所建议的完整路径,但会遇到相同的错误。
import win32api,time
from win32com.client import Dispatch
strDbName = '\\server\folder\file.accdb'
objAccess = Dispatch("Access.Application")
objAccess.Visible = False
objAccess.OpenCurrentDatabase(strDbName)
objDB = objAccess.CurrentDb()
objAccess.DoCmd.RunMacro('test')
objAccess.Application.Quit()
我的访问存储在我写的网络路径中,
strDbName = '\\server\folder\file.accdb'
我也尝试过
strDbName = 'r\\server\folder\file.accdb'
,但我总是会遇到错误:“ Microsoft Access无法打开数据库,因为它丢失或仅由另一个用户打开,或者不是ADP文件。”
有线索吗?
I have the same exact problem than
Running a saved MS Access macro in python: ERROR
I' using the exact same code but with my Access File and Macro names, using the complete path as suggested but getting the same error.
import win32api,time
from win32com.client import Dispatch
strDbName = '\\server\folder\file.accdb'
objAccess = Dispatch("Access.Application")
objAccess.Visible = False
objAccess.OpenCurrentDatabase(strDbName)
objDB = objAccess.CurrentDb()
objAccess.DoCmd.RunMacro('test')
objAccess.Application.Quit()
My access is stored in a network path that I'm writing like this
strDbName = '\\server\folder\file.accdb'
I have also tried
strDbName = 'r\\server\folder\file.accdb'
but I always get the error "Microsoft Access can't open the database because it is missing, or opened exclusively by another user, or it is not an ADP file."
any clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论