How to fix the issue "The file is corrupt and cannot be opened" when opening an Excel file (VBscript)

Introduction

This VBScript shows how to fix the issue "The file is corrupt and cannot be opened" when opening an Excel file.

Scenarios

Some consumers encounter an issue "The file is corrupt and cannot be opened" error on office Excel while opening .xls files. This script will try to fix that.

 

Script

Step1:  Double-click FixExcelCorruptedError.vbs to run this VBScript sample. The step is shown in the following figure.

 

The step is shown in the following figure.

 

 

When script finishes running, you will see something as shown in the following figure.

 

 

Here are some code snippets for your references.

VB Script
Edit|Remove
'Create the key of registry 
objRegistry.CreateKey HKEY_CURRENT_USER,strKeyPath & "\ProtectedView" 
  
'Setting the value of registry 
objRegistry.SetDWORDValue HKEY_CURRENT_USER,strKeyPath & "\ProtectedView",strValueName1,dwValue 
objRegistry.SetDWORDValue HKEY_CURRENT_USER,strKeyPath & "\ProtectedView",strValueName2,dwValue 
objRegistry.SetDWORDValue HKEY_CURRENT_USER,strKeyPath & "\ProtectedView",strValueName3,dwValue 
 
 

Prerequisite

Office Excel 2007 or higher version