打开excel文件时出现运行时错误 [英] Run-time error upon opening excel file

查看:2242
本文介绍了打开excel文件时出现运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 button_click 事件中打开excel文件。我打开的前四个excel文件没有遇到任何错误,但是当我的宏打开第五个时,它停止并显示这个运行时错误:

 运行时错误'-2147021892(80070bbc)':

office检测到此文件有问题。
为了保护您的计算机,此文件无法打开。

这是我打开excel文件的代码:

 设置wb = Workbooks.Open(fileName:= fileName,UpdateLinks = =)


解决方案

可能的解决方案




症状



您在Microsoft Office 2010应用程序中执行以下操作之一:



•打开嵌入对象



•执行邮件合并



•从查看器中打开文件



在这种情况下,您会收到以下错误消息:



Office检测到此文件有问题。为了保护您的计算机,此文件无法打开。



原因



出现此问题是因为Office文件验证检测一个问题
与该文件可能构成安全风险。您收到恶意文件或损坏文件的错误
消息。


似乎Office正在检测到某些可能的东西恶意与文件,如病毒或其他恶意软件,或者只是可能文件已损坏。如果您信任本文档,请继续打开它。否则要非常谨慎,以避免某种类型的恶意软件感染。


I'm trying to open excel files in a button_click event. I don't encounter any errors with the first four excel files i opened, but as my macro open the fifth one, it stops and shows this run-time error:

Run-time error '-2147021892 (80070bbc)':

office has detected a problem with this file. 
To help protect your computer this file cannot be opened.

Here's my code for opening excel files:

    Set wb = Workbooks.Open(fileName:=fileName, UpdateLinks:=True)

解决方案

Possible resolutions

Microsoft Support - Error message in Office when a file is blocked by registry policy settings gives several mechanisms for how to possibly bypass this error if you trust the document content.

Some Key Notes:

For Excel 2010 or 2013

Change the File Block settings to disable the restriction of certain file types through File -> Options -> Trust Center -> Trust Settings

For Excel 2003 or 2007

You have to change the value of the FileOpenBlock registry subkey to disable the restriction of certain file types. This is located at

For Excel 2007:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Excel\Security\FileOpenBlock

For Excel 2003:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security\FileOpenBlock

Subkeys should be as follows:

Why this is occurring

From Microsoft Support:

SYMPTOMS

You perform one of the following actions in a Microsoft Office 2010 application:

•Open an embedded object

•Perform a mail merge

•Open a file from a viewer

In this situation, you receive the following error message:

Office has detected a problem with this file. To help protect your computer this file cannot be opened.

CAUSE

This problem occurs because Office File Validation detects a problem with the file that may pose a security risk. You receive the error message for a malicious file or for a damaged file.

It appears that Office is detecting something possibly malicious with the file, such as a virus or other malware, or it's just possible that the file is corrupted. If you trust this document, proceed with opening it. Otherwise be extremely cautious to avoid an malware infection of some type.

这篇关于打开excel文件时出现运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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