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
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.