我试图使用Excel打开Access 2003 .mde文件。
到目前为止,我已经尝试过:
Shell ("cscript "C:\User\Folder\Access Database.mde""), vbHide现在,这可以很好地打开一个.vbs文件,并且运行代码来打开.mde文件,但实际上并不打开数据库。
我还尝试了以下几点:
strdb = "C:\User\Folder\Access Database.mde"
Set AccessApp = CreateObject("Access.Application")
AccessApp.Visible = True
AccessApp.OpenCurrentDatabase.strdb
AccessApp.DoCmd.OpenForm "frmsysteminformation"
Set AccessApp= Nothing我在网上找到了这个,但是它给了我一个调试错误,突出显示了一行:
Set AccessApp = CreateObject("Access.Application")谢谢
编辑我的公司似乎已经禁用了一些功能,如
CreateObject("Outlook.Application")也不管用。有办法在cscript中运行吗?
发布于 2016-08-23 16:31:24
万一有人无意中发现了同样的问题,我设法解决了:
Dim sAcc
Dim sFrontEnd
Dim sSec
Dim sUser
Dim objShellDb
Dim sComTxt
'Script Configuration Variable
'*******************************************************************************
'Specify the Fullpath and filename of the msaccess executable
sAcc = "C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
'Specify the Fullpath and filename of the database to launch
sFrontEnd = "C:\users\file location\Database to open.mde"
Set objShellDb = CreateObject("WScript.Shell")
'Build the command to launch the database
sComTxt = Chr(34) & sAcc & Chr(34) & " " & Chr(34) & sFrontEnd & Chr(34)
objShellDb.Run sComTxt 'Launch the database
End Subhttps://stackoverflow.com/questions/39083228
复制相似问题