Access VBA中的Shell cmd返回错误5-无效的过程调用或参数 [英] Shell cmd in access vba returns error 5 - invalid procedure call or argument

查看:511
本文介绍了Access VBA中的Shell cmd返回错误5-无效的过程调用或参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年来,我已经在MS Access中的多个版本的多个数据库中使用Shell命令.最近,我收到了此运行时错误5-多年来使用的Shell命令上的无效过程调用或参数.谁能告诉我是否有最近的Windows更新或MS Office更新导致此错误出现?我目前正在使用Office 2010和Office 2013,并且在多台计算机上的两个版本中都收到相同的错误.我什至尝试创建一个简单的空数据库,然后直接进入vba窗口,并在直接窗口中尝试了一个简单的Shell命令,如下所示:

I have used the Shell command in MS Access for several years in multiple databases in various versions. Most recently, I have received this Run-Time error 5 - invalid procedure call or argument on a Shell command I have used for many years. Can anyone tell me if there was a recent Windows update or possibly MS Office update that has caused this error to appear? I am currently using Office 2010 and Office 2013 and receiving the same error in both version on multiple computers. I have even tried creating a simple empty database and gone straight to the vba window and in the immediate window tried a simple Shell command as such:

Shell "C:\Notepad.bat", vbNormalFocus  

Notepad.bat是其中的一个简单命令:

Notepad.bat is a simple command inside it:

cmd /C "Notepad.exe"

代码:

Shell "Notepad.exe", vbNormalFocus 

可以,但是:

Shell "Cmd.exe", vbNormalFocus 

在我对其进行测试的每台机器上仍然给出相同的错误5消息.从Windows资源管理器运行批处理文件就可以了.非常感谢您的帮助.

still gives the same Error 5 message on every machine I test it on. Running the batch files from the Windows explorer works just fine. Any help is much appreciated.

推荐答案

经过大量调查,我发现由维护我们的McAfee保护的网络软件工程师安装的新软件.上周,盲目安装了一个名为Adaptive Threat Protection的新应用程序,该应用程序将检查运行shell命令(尤其是CMD类型)的MS Office应用程序.设置为自动阻止所有这些命令.我最终得出结论,可以查看计算机上最近安装或更新的所有内容,并偶然发现在上周日期范围内安装的一些其他内容.到目前为止,感谢您的协助和解答. thx1138v2提供的答案是我在发布帖子之前也尝试过的方法,但是我想出我的第一个问题,试图将发布的内容保持在最低限度.

After a lot more investigation, I happened on a new software installed by our network software engineers that maintain our McAfee protection. Last week, there was a blind install of a new app called Adaptive Threat Protection and is set to check for MS office apps running shell commands, especially the CMD type. This is set to automatically block all of these such commands. I finally came to a conclusion to look in anything recently installed or updated on my computer and happen to find a few different things installed within the last week date range. Thank you for your assistance and answers so far. The answer provided by thx1138v2 were something I also tried prior to my post but I figured for my 1st question I tried to keep my post to a bit of a minimum.

这篇关于Access VBA中的Shell cmd返回错误5-无效的过程调用或参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆