How to Fix Compile Error in Hidden Module in Excel

Microsoft Excel users often encounter the “Compile Error in Hidden Module” issue. It generally occurs while running any code in Microsoft Visual Basic for Applications in Excel. There are multiple reasons behind this issue. Therefore, in this Excel tutorial, we will find out how to fix Compile Error in Hidden Module in Excel with 6 possible reasons and their solutions.

Compile Error in Hidden Module Alert in Excel

The above overview image shows unprotecting the VBA module to solve the issue. This is one of the reasons. Follow below to see other reasons and solutions.


What Is Compile Error in Hidden Module in Excel VBA?

Compile Error in Hidden Module is a kind of security alert in Excel VBA. It generally occurs when the VBA code is not compatible with the version or architecture of the Excel application. As a result, when we try to run the code, it pops up the alert.


Compile Error in Hidden Module in Excel: 6 Possible Reasons with Solutions

In this section, we will discuss six reasons that generate Compile Error in Hidden Module in Excel. Along with it, we will demonstrate solutions for each of them.


Reason 1: You Have Password-Protected VBA Module

Any kind of VBA module that is password-protected will act as a hidden module. You need to have full access to this kind of Excel file. Otherwise, it will require permission from its owner.

Solution: Unprotect VBA Module to Solve Compile Error in Hidden Module in Excel

To fix this error, follow the steps below.

  • First, we need to enable the Developer tab.
  • For this, go to the File window.

Choosing File Tab from Excel Ribbon

  • Then, select Option in the Overview Panel.

Selecting Options from Overview Panel

  • Afterward, choose the Customize Ribbon tab.
  • Following this, check the Developer feature under Customize the Ribbon.
  • Lastly, click OK to close the Excel Options box.

Activating Developer Tab in Excel Options Wndow

  • Now, go to the Developer tab and select Visual Basic under the Code section.

Opening Visual Basic from Developer Tab

  • Then, right-click on the hidden nodule and select VBAProject Properties.

Opening VBAProject Properties of Selected Module

  • Next, VBAProject – Project Properties window will appear.
  • Here, go to the Protection tab and remove the password.
  • Lastly, press OK.

Removing Password in VBAProject - Project Properties Dialogue Box

  • Finally, the code will run smoothly in Excel.

Read More: VBA Object Variable or with Block Variable Not Set in Excel


Reason 2: Missing References in Visual Basic Editor

In Excel VBA, if you want to work with Objects available in different applications, you need to add a reference to the object library of that application. But the unavailability of those specific references will result in Compile Error in Hidden Module.

Solution: Activate Missing References in VBE to Remove Compile Error in Hidden Module in Excel

To solve this issue, you need to enable any kind of missing references in the Visual Basic Editor. For this, follow the steps below.

  • First, open Developer > Visual Basic on your workbook.
  • Then, select References from Tools.

Opening References from Tools Tab

  • After that, scroll down through the list of Available References that you want to activate.
  • In this case, mark the Microsoft Word 16.0 Object Library reference to enable.
  • Lastly, press OK to close the window.

Activating Required Reference in References - VBAProject Window

  • Finally, try to run the VBA code and you will not get the error anymore.

Read More: [Fixed!] Subscript Out of Range Error in Excel VBA


Reason 3: MS Excel Containing Template Files of Add-ins

Any kind of third-party Excel Add-ins (such as Adobe Acrobat PDF Maker) can boost the functionality of Excel. However, when these add-ins are incompatible with the VBA project, it will cause a compile error in hidden modules.

Solution: Remove External Add-ins to Fix Compile Error in Hidden Module in Excel

This error can be solved from the Excel Developer tab and the Excel Start-up Folder as well. Let’s see how it works in both cases.

1. Remove Add-ins from Developer Tab

To erase add-ins from the Developer tab, follow the steps below.

  • First, open Excel Add-ins from the Developer tab.

Opening Excel Add-ins from Developer Tab

  • Then, uncheck the add-ins that you don’t require.
  • Lastly, press OK and you will successfully solve the Compile Error in Hidden Module.

Deselcting Unnecessary Add-ins

2. Remove Add-ins from Excel Start-up Folder

Follow the steps below to remove any unnecessary add-ins from the Excel Start-up Folder.

  • In the beginning, close all the opened Excel files.
  • Then, go to the File Explorer of your device.
  • Here, open the XLSTART folder which is located in C:\Users\USERNAME\AppData\Roaming\Microsoft\Excel\
  • Lastly, remove every unused XLA or XLAM.
  • Finally, restart Excel and the error will be fixed.

Read More: Reasons And Solutions for Excel Object Required Error in VBA


Reason 4: Incorrect Syntax in VBA Code

If the solutions above don’t fix the issue from inside Excel, then there must be an incorrect syntax in the VBA code running.

Solution: Fix Syntax Error in VBA Code to Solve Compile Error in Hidden Module

To determine the syntax error to solve, go through the process below.

  • First, press Alt + F11 on your keyboard to open the Visual Basic Editor.
  • Then, click on Compile VBAProject under Debug tab while your code is opened.

Selecting Compile VBAProject from Debug Tab in Visual Basic Editor

  • As a result, it will show the Syntax error alert highlighting the location in the code.

Determining Syntax Error to Fix

  • Next, press OK and then correct the code where highlighted.
  • Lastly, open Debug again and you will see the Compile VBAProject option is greyed out. It means, the code is successfully compiled and the error is resolved.

Successful Compilation of VBAProject after Correcting Syntax

Read More: [Fixed!] Excel Application-Defined or Object-Defined Error in VBA


Reason 5: Unsupported Registered OCX Files

OCX file is a form of Windows ActiveX Control file. It helps to customize and reuse user interface design. Any kind of unregistered or incompatible OCX file may result in Compile Error in Hidden Module in Excel.

Solution: Use Command Prompt (CMD) to Re-register OCX Files to Fix Compile Error in Hidden Module in Excel

To solve this issue, we need to register that specific OCX file again. Let’s see how it works.

  • In the beginning, press the Windows icon on your keyboard and then press the R button to open the Run box.
  • Here, type cmd and press OK.

Opening Command Promt (cmd) in Run

  • Lastly, type one of the following commands based on your system version in the Command Prompt (cmd).

Inserting Required Command to Re-register OCX Files

  • In 32-bit version type:

regsvr32 -u c:\windows\system32\mscomctl.ocx

regsvr32 c:\windows\system32\mscomctl.ocx

  • In 64-bit version type:

regsvr32 -u c:\windows\syswow64\mscomctl.ocx

regsvr32 c:\windows\syswow64\mscomctl.ocx

  • Finally, run Excel and you will not receive the Compile Error in Hidden Module issue.

Read More: [Fixed!] Invalid Forward Reference in VBA


Reason 6: Unwanted .exd Files in Device Folders

In the device folders, .exd files are stored to allow additional controls in much less time. But when it’s not aligned with the application, it causes a compile error.

Solution: Delete .exd Files to Repair Compile Error in Hidden Module in Excel

We need to remove these unwanted .exd files to solve this issue. For this, follow the steps below.

  • First, open Run.
  • Then, type %appdata% and press OK.

Typing %appdata% Command in Run

  • Afterward, it will open the Application Data Folder.
  • Here, open the Microsoft folder.

Selecting Microsoft Folder from List

  • Following this, open the Forms folder.

Opening Forms Folder

  • Inside the Forms folder, select the files and then right-click to select Delete to remove them as shown below.

Deleting selected .exd Files

  • Finally, restart the Excel file and the error will be solved.

Read More: [Fixed!] Unable to Set the Visible Property of the Worksheet Class


How to Externally Solve Compile Error in Hidden Module for Excel

If the above solutions do not work entirely, then you can try the following methods that will externally solve the Compile Error in Hidden Module in Excel.


Method 1: Move Adobe Acrobat PDF Maker Files

If you have installed Adobe Acrobat PDF Maker on your device, then you need to relocate the pdfmaker.dot file and pdfmaker.xla files to a different location. For this, follow the steps given below:

  • In the beginning, select the Windows icon and input * in the search bar.
  • Then, select the files and folders on the appeared window.
  • Following this, in the All or part of the file name type * and search for it.
  • Next, select the dot & pdfmaker.xla files in the folder > right-click > select the Cut option.
  • Lastly, Paste it where you wish on your Desktop to solve the error.

Read More: Because of Your Security Settings Macros Have Been Disabled


Method 2: Update Available Latest Version of Adobe Acrobat

You may need to update your installed Adobe Acrobat software.

  • For this, click on Help in Adobe’s window.
  • Then, choose the Check for Updates option to open the updater window.
  • Lastly, press the Download and Install button in case of any updates are required.

Method 3: Uninstall Norton Antivirus Software from Device

To solve the error, it is advisable to uninstall the Norton Antivirus Software from your device rather than update it.

  • For this, press Windows + R on your keyboard to open Run.
  • Then, type cpl in Run, and click on the OK button.
  • Lastly, select the Norton Antivirus software from the list and click on the Uninstall button to remove the software after confirmation.

Read More: [Fixed!] Method Open of Object Workbooks Failed


Frequently Asked Questions

1. How can I open Excel in safe mode?

To open Excel in safe mode, press and hold the Ctrl button while opening the file. You can also apply the safe switch (such as excel.exe/safe) while starting the program from the command line.

2. How can I Repair MS Excel when it Crashes?

Microsoft has introduced MS Excel Repair Tool which can quickly fix when it crashes. This handy tool is available in all Excel versions. This tool helps to sort damaged, corrupted, or inaccessible Excel files. It also recovers erased or lost data from Excel spreadsheets, cell comments, pivot charts, functions, formulas & lots more.


Conclusion

Finally, we are at the conclusion of our article. Here, we tried to explain how to fix Compile Error in Hidden Module in Excel. We demonstrated 6 possible reasons for this error and tried to solve each of them carefully. We also explained the methods to solve this error externally. Let us know your feedback in the comment section. Follow ExcelDemy for more articles like this.


Related Articles:

Get FREE Advanced Excel Exercises with Solutions!
Sanjida Mehrun Guria
Sanjida Mehrun Guria

Hello! Welcome to my blog. I have completed my Bachelor in Architecture from Ashanullah University of Science & Technology, Dhaka. I am a passionate, goal-oriented person with an immense thirst for knowledge and an attitude to grow continuously. Besides Architectural work, I find it very enthusiastic to work in Excel blogging. Exceldemy is a platform where I have got the opportunity to flourish my skill in Microsoft Excel and therefore, here I will be posting blogs related to... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo