What is compile error in excel

Содержание

  1. Compile error in hidden module excel 2016 как исправить
  2. Ошибка компиляции в скрытом модуле:
  3. Поддержка и обратная связь
  4. Ошибка в Excel “Compile Error in Hidden Module”
  5. Решения для ошибки компиляции в скрытом модуле в Excel или Word [Новости MiniTool]
  6. Ошибка компиляции Excel или Word в скрытом модуле
  7. Исправления ошибок компиляции в скрытом модуле Excel или Word
  8. Обновите Adobe Acrobat
  9. Используйте CMD для регистрации файлов OCX
  10. Переместить файлы Pdfmaker в другую папку
  11. Удалить файлы .exd
  12. Обновите антивирус Norton
  13. Конец
  14. Fix Compile error in hidden module in Excel or Word
  15. Fix Compile error in hidden module in Excel or Word
  16. 1] Unprotect the VBA code module
  17. 2] Reregistering OCX files with the Command Prompt
  18. 3] Updating Adobe Acrobat
  19. 4] Moving PDFmaker files to another folder
  20. 5] Update or Uninstall the Norton Antivirus software
  21. How do I open Excel in safe mode?
  22. What is the safe mode in Microsoft Word?
  23. Excel VBA Error Handling – All You Need to Know!
  24. Types of VBA Errors in Excel
  25. Syntax Error
  26. Compile Error
  27. Run Time Errors
  28. Logical Errors
  29. Using Debug to Find Compile/Syntax Errors
  30. Configure Error Settings (Handled Vs Unhandled Errors)
  31. VBA Error Handling with ‘On Error’ Statements
  32. On Error Resume Next
  33. On Error GoTo 0
  34. On Error Goto [Label]
  35. On Error Goto -1
  36. The Err Object
  37. Err Object Properties
  38. Err Object Methods
  39. Err Clear Method
  40. Err Raise Method
  41. VBA Error Handling Best Practices

Ошибка компиляции в скрытом модуле:

Защищенный модуль содержит ошибку компиляции. Так как эта ошибка находится в защищенном модуле, ее нельзя отобразить.

Эта ошибка обычно возникает в случае несовместимости кода с версией или архитектурой данного приложения (например, код в документе рассчитан на 32-разрядные приложения Microsoft Office, однако предпринимается попытка его запуска в 64-разрядной версии Office).

Эта ошибка имеет следующие причину и решение:

  • Ошибка возникает при наличии ошибки компиляции в коде VBA внутри защищенного (скрытого) модуля. Эта ошибка компиляции не отображается, так как модуль является защищенным.

Если у вас есть доступ к коду VBA в документе или проекте, отмените защиту модуля, а затем запустите код еще раз для просмотра сведений об ошибке.

Если доступ к коду VBA в документе отсутствует, обратитесь к автору документа, чтобы он обновил код вскрытом модуле.

Хотите создавать решения, которые расширяют возможности Office на разнообразных платформах? Ознакомьтесь с новой моделью надстроек Office. Надстройки Office занимают меньше места по сравнению с надстройками и решениями VSTO, и вы можете создавать их, используя практически любую технологию веб-программирования, например HTML5, JavaScript, CSS3 и XML.

Поддержка и обратная связь

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

Ошибка решается, проверкой не включенных модулей в окне VB,проверьте все ли необходимые модули включены,и есть ли эти модули на самом деле на ПК,возможно модуль отмечен,но сам отсутствует у меня проблему решило,включением специфических модулей для конкретного файла с расчетами.

Решение проблемы: Откройте файл в Excel – при помощи комбинации клавиш войдите в окно Visual Basic(ALT+F11), далее выберите меню “Tools-References” и посмотрите все ли отмеченные модули есть на самом деле на компьютере и все ли модули необходимые для работы Вашего макроса включены.

Error in Excel “Compile Error in Hidden Module”
Can be happen when Excel miss some reference to library.
For fix: Open Excel – Go to VB window -(ALT+F11).Open Tools-References and check unchecked modules(only needed for your Document).

Решения для ошибки компиляции в скрытом модуле в Excel или Word [Новости MiniTool]

При использовании Excel или Word вы можете получить сообщение об ошибке «Ошибка компиляции в скрытом модуле». Что делать, чтобы избавиться от ошибки компиляции Word или Excel на ПК с Windows? Успокойтесь, и теперь вы можете получить несколько простых методов из этого сообщения, предлагаемого MiniTool .

Ошибка компиляции Excel или Word в скрытом модуле

При запуске Excel или Word на экране вашего компьютера может появиться сообщение «Ошибка компиляции в скрытом модуле». Модуль может быть thisworkbook, hstbarpublic, menuandtoolbar, aowd и т. Д.

Почему возникает ошибка компиляции? Это связано с тем, что Microsoft обновляет Office 2016 с 32-разрядной версии до 64-разрядной версии, но в Office есть несовместимые 32-разрядные надстройки. То есть некоторые надстройки содержат код, несовместимый с текущей версией Office 2016.

Что делать, чтобы избавиться от ошибки? Решения для вас ниже.

Устранение неполадок Excel и спасение ваших данных (несколькими способами)

Вы хотите избавиться от Microsoft Excel, который не отвечает? В этом посте мы покажем вам несколько методов, которые могут эффективно решить эту проблему.

Исправления ошибок компиляции в скрытом модуле Excel или Word

Обновите Adobe Acrobat

Два файла шаблона Adobe Acrobat в папке Office могут вызвать сообщение об ошибке компиляции. Одно из возможных решений — обновить Adobe Acrobat.

Шаг 1. Щелкните это приложение, перейдите в Справка> Проверить обновления .

Шаг 2. Если есть обновления, нажмите Загрузить и установить .

Используйте CMD для регистрации файлов OCX

Чтобы исправить ошибку компиляции Excel, вам необходимо зарегистрировать некоторые файлы, необходимые для работы Excel. Просто следуйте этим инструкциям:

Шаг 1. Запустите командную строку (CMD) с правами администратора.

Шаг 2: Введите следующие команды и нажмите Войти после каждого:

В 32-битной Windows:

regsvr32 -u c: windows system32 mscomctl.ocx

regsvr32 c: windows system32 mscomctl.ocx

В 64-битной Windows:

regsvr32 -u c: windows syswow64 mscomctl.ocx

regsvr32 c: windows syswow64 mscomctl.ocx

Шаг 3: Запустите Excel и посмотрите, исправили ли вы ошибку компиляции в скрытом модуле.

Переместить файлы Pdfmaker в другую папку

Pdfmaker.xla и pdfmaker.dot — это два файла Adobe Acrobat, вызывающие ошибку компиляции. Итак, вы можете переместить эти файлы из папок MS Office, чтобы исправить проблему.

Шаг 1: введите pdfmaker.xla в поле поиска и щелкните его правой кнопкой мыши, чтобы выбрать Откройте расположение файла .

Шаг 2: В проводнике скопируйте и вставьте этот файл в другую папку, например на рабочий стол.

Шаг 3. Сделайте то же самое с файлом pdfmaker.dot.

Теперь вам нужно избавиться от ошибки компиляции в скрытом модуле.

Удалить файлы .exd

Если описанные выше решения не помогли, попробуйте удалить файлы .exd со своего компьютера. Это может быть полезно для исправления ошибки компиляции Excel или Word в скрытом модуле.

Шаг 1: нажмите Win + R , ввод %данные приложения% и нажмите Хорошо .

Шаг 2: нажмите Microsoft> Формы .

Шаг 3. Щелкните правой кнопкой мыши comctllib.exd и mscomctllib.exd и щелкните удалять чтобы удалить их по одному.

Обновите антивирус Norton

Norton Antivirus может быть связан с ошибкой компиляции в скрытом модуле. Если на вашем настольном компьютере или ноутбуке установлено это программное обеспечение, его обновление может помочь решить проблему.

Шаг 1. Перейти к эта ссылка и нажмите Обновите меня сейчас .

Шаг 2: Щелкните файл .exe, чтобы запустить его и завершить обновление.

Если обновление не может решить вашу проблему, вы можете удалить это антивирусное программное обеспечение со своего компьютера и посмотреть, удаляется ли ошибка. Просто обратитесь к этому сообщению — Четыре идеальных способа: как удалить программы в Windows 10 .

Конец

Вас беспокоит ошибка компиляции в скрытом модуле при использовании Word или Excel? Не принимайте это близко к сердцу. Попробовав эти методы, вы легко и эффективно избавитесь от этой проблемы.

Источник

Compile error in a hidden module is an error message that may be shown for some Microsoft Word and Microsoft Excel users. This message is generally displayed when Office users open Word or Excel. After this message, the application does not launch.

This error occurs when the code is incompatible with the version or architecture of this application. For instance, if code in a document targets 32-bit Microsoft Office applications but it is attempting to run on 64-bit Office, then this error can occur.

The error is raised when a compilation error exists in the VBA code inside a protected (hidden) module. The specific compilation error is not exposed because the module is protected.

Try the following suggestions to fix the issue:

  1. Unprotect the VBA code module
  2. Re-registering OCX files with the Command Prompt
  3. Updating Adobe Acrobat
  4. Moving PDfmaker files to another folder
  5. Updating or Uninstalling the Norton Antivirus software

Let us look at these ways in more detail.

1] Unprotect the VBA code module

Now, if you are facing this error, do the following:

  • If you have access to the VBA code in the document or project, unprotect the module, and then run the code again to view the specific error.
  • If you don’t have access to the VBA code in the document, then contact the document author to have the code in the hidden module updated.

This is the official workaround. If that does not help, try the following suggestions:

2] Reregistering OCX files with the Command Prompt

The compile error in hidden module error could also be a side effect of Windows updates. Hence, registering a mscomctl.ocx file may fix the issue. To reregister the OCX file, follow the given steps:

Press Windows + X hotkey. Choose Command Prompt (Admin) to run the prompt as an administrator.

In the case of a 32-bit Windows computer, provide the following commands in the prompt:

In the case of a 64-bit Windows computer, provide the following commands in the prompt:

3] Updating Adobe Acrobat

This applies to you if you are using Adobe Acrobat.

The compile error in hidden module error could also occur due to two Adobe Acrobat template files in MS Office folders. It is advisable to install the Adobe software from an official website to avoid this error. In case you come across this error, you can export PDFs into other Microsoft 365 like Word, Excel, or PowerPoint. You can update Adobe by clicking on Help in Adobe’s window. Choose Check for Updates to open the updater window. You can then press the Download and Install button in case of any update.

4] Moving PDFmaker files to another folder

This applies to you if you are using PDFmaker

The compile error in hidden module error is connected to two Adobe Acrobat files i.e. PDFmaker.xla and PDFmaker.dot. Hence, moving these files out of the MS Office folders may also fix the error. You can also follow the below steps:

  • Press Type here to search button and open Cortana’s search box. Type PDfmaker.xla in the search box to look for that file.
  • Type PDFmaker.dot in the search box to look for the file. Right-click the said files and choose Open file location to open the folders in the File Explorer.
  • In case you cannot find the files, you can open the MS Office Start-up and Xlstart folders in the File Explorer.
  • Right-click on the files in the File Explorer and choose the Cut option to move the PDfmaker files to the desktop. Right-click another folder to move them and choose Paste.

5] Update or Uninstall the Norton Antivirus software

This applies to you if you are using Norton software

The Norton Antivirus may also be connected to compile error in hidden module error. If it is installed, updating the software can fix the issue. You can check for updates by pressing the Update Me Now button. You can right-click the Norton Antivirus system tray icon and choose Norton LiveUpdate.

In case a Norton Antivirus update does not fix the issue, you can uninstall the Norton software.

Press Windows + R shortcut to open the Run windows. Type appwiz.cpl in Run, and click on the OK button. Choose the listed Norton Antivirus software and click on the Uninstall button to remove the software after confirmation.

We hope that one of the above-mentioned solutions helps you fix the compile error in hidden module error and re-launch Word and Excel. Do let us know in case of any queries or suggestions.

How do I open Excel in safe mode?

You can open Excel in safe mode by pressing and holding the Ctrl button as you start the program. You can also use the safe switch (excel.exe/safe) when you start the program from the command line.

Fix: The file is corrupt and cannot be opened error in Word, Excel, PowerPoint

What is the safe mode in Microsoft Word?

When you cannot use Microsoft Office normally, you can use a built-in safety feature. If Word or Excel crashes every time you open it, you can start the said application in safe mode and it helps you work normally.

Источник

Excel VBA Error Handling – All You Need to Know!

No matter how experienced you’re with VBA coding, errors are always going to be a part of it.

The difference between a novice and an expert VBA programmer is that the expert programmers know how to effectively handle and use errors.

In this tutorial, I will show you various ways you can use to handle errors effectively in Excel VBA.

Before we get into VBA error handling, let’s first understand the different types of errors you are likely to encounter when programming in Excel VBA.

This Tutorial Covers:

Types of VBA Errors in Excel

There are four types of errors in Excel VBA:

  1. Syntax errors
  2. Compilation errors
  3. Runtime errors
  4. Logical Errors

Let’s quickly understand what these errors are and when you’re likely to encounter these.

Syntax Error

A syntax error, as the name suggests, occurs when VBA finds something wrong with the syntax in the code.

For example, if you forget a part of the statement/syntax that is needed, then you will see the compile error.

In the below code, as soon as I hit enter after the second line, I see a compile error. This is because the IF statement needs to have the ‘Then‘ command, which is missing in the below code.

To make sure you see the syntax error whenever there is something missing, you need to make sure Autosyntax check is enabled. To do this, click on ‘Tools’ and then click on ‘Options’. In the options dialog box, make sure that the ‘Auto Syntax Check’ option is enabled.

If the ‘Auto Syntax Check’ option is disabled, VBA will still highlight the line with the syntax error in red, but it will not show the error dialog box.

Compile Error

Compile errors occur when something is missing that is needed for the code to run.

For example, in the below code, as soon as I try to run the code, it will show the following error. This happens as I have used the IF Then statement without closing it with the mandatory ‘End If’.

VBA checks each line as you’re typing the code and highlights the syntax error as soon as the line is incorrect and you hit enter. Compile errors, on the other hand, are only identified when the entire code is analyzed by VBA.

Below are some scenarios where you’ll encounter the compile error:

  1. Using an IF Statement without the End IF
  2. Using For statement with the Next
  3. Using Select statement without using the End Select
  4. Not declaring the variable (this works only when Option Explicit is enabled)
  5. Calling a Sub/Function that does not exist (or with wrong parameters)

Run Time Errors

Runtime errors are those that occur when the code is running.

Run time errors will occur only when all the syntax and compile errors are being taken care of.

For example, if you run code that is supposed to open an Excel workbook, but that workbook is unavailable (either deleted or name changed), your code would give you a runtime error.

When a runtime error occurs, it will stop the code and show you the error dialog box.

The message in the Run-time error dialog box is a little more helpful. It tries to explain the problem that can help you correct it.

If you click on the Debug button, it will highlight the part of the code that is leading to the error.

If you have corrected the error, you can click on the Run button in the toolbar (or press F5) to continue running the code from where it left.

Or you can also click on the End button to come out of the code.

Logical Errors

Logical errors would not make your code stop but can lead to wrong results. These could also be the most difficult types of errors to troubleshoot.

These errors are not highlighted by the compiler and need to be manually tackled.

One example of logical error (that I often find myself stuck with) is running into an endless loop.

Another example could be when it gives a result which is wrong. For example, you may end up using a wrong variable in the code or add two variables where one is incorrect.

There are a few ways I use to tackle logical errors:

  1. Insert Message Box at some place in the code and highlight values/data that can help understand if eberything is going as expected.
  2. Instead of running the code at one go, go through each line one by one. To do this, click anywhere in the code and press F8. you would notice that each time you press F8, one line gets executed. This allows you to go through the code one line at a time and identify the logical errors.

Using Debug to Find Compile/Syntax Errors

Once you’re done with the code, it’s a good practice to first compile it before running.

To compile a code, click on the Debug option in the toolbar and click on Compile VBAProject.

When you compile a VBA project, it goes through the code and identifies errors (if any).

In case it finds an error, it will show you a dialog box with the error. It finds errors one by one. So if it finds an error and you have corrected it, you need to run compile again to find other errors (if there are).

When you’re code is free of errors, the Compile VBAProject option will be greyed out.

Note that Compiling will only find ‘Syntax’ errors and ‘Compile’ errors. It will NOT find the run-time errors.

When you’re writing VBA code, you don’t want the errors to crop up. To avoid this, there are many error-handling methods you can use.

In the next few sections of this article, I will be covering the methods you can use for VBA error handling in Excel.

Configure Error Settings (Handled Vs Unhandled Errors)

Before you start working with your code, you need to check for one setting in Excel VBA.

Go to the VBA toolbar and click on Tools and then click on Options.

In the Options dialog box, click on the General tab and make sure that within the ‘Error Trapping’ group, ‘Break on Unhandled Errors’ is checked.

Let me explain the three options:

  1. Break on All Errors: This will stop your code on all types of errors, even when you have used the techniques to handle these errors.
  2. Break in Class Module: This will stop your code on all unhandled errors, and at the same time, if you’re using objects such as Userforms, it will also break within those objects and highlight the exact line causing the error.
  3. Break on Unhandled Errors: This will stop your code only for those errors that are not handled. This is the default setting as it ensures any unhandled errors are brought to your notice. If you’re using objects such as Userforms, this will not highlight the line causing the error in the object, but will only highlight the line that’s referring to that object.

So in a nutshell – if you’re just starting with Excel VBA, ensure ‘Break on Unhandled Errors’ is checked.

VBA Error Handling with ‘On Error’ Statements

When your code encounters an error, there are a few things you can do:

  1. Ignore the error and let the code continue
  2. Have an error handling code in place and run it when an error occurs

Both of these error handling methods ensures that the end user will not get to see an error.

There are a few ‘On Error’ statements that you can use to get these done.

On Error Resume Next

When you use ‘On Error Resume Next’ in your code, any encountered error will be ignored and the code will continue to run.

This error handling method is used quite often, but you need to be cautious when using it. Since it completely ignores any error that may occur, you may not be able to identify the errors that need to be corrected.

For example, if the below code is run, it will return an error.

This happens because you can not divide a number by zero.

But if I use the ‘On Error Resume Next’ statement in this code (as shown below), it will ignore the error and I will not know that there is an issue that needs to be corrected.

On Error Resume Next should be used only when you clearly know the kind of errors your VBA code is expected to throw and it’s alright to ignore it.

For example, below is the VBA event code that would instantly add the date and time value in cell A1 of a newly inserted sheet (this code is added in the worksheet and not in a module).

While this works great in most cases, it would show an error if I add a chart sheet instead of a worksheet. Since a chart sheet does not have cells, the code would throw an error.

So, if I use the ‘On Error Resume Next’ statement in this code, it will work as expected with worksheets and do nothing with chart sheets.

Note: On Error Resume Next Statement is best used when you know what kind of errors you’re likely to encounter. And then if you think it’s safe to ignore these errors, you can use it.

You can take this code to the next level by analyzing if there was an error, and displaying a relevant message for it.

The below code would show a message box that would inform the user that a worksheet has not been inserted.

‘Err.Number’ is used to get the error number and ‘Err.Description’ is used to get the error description. These will be covered later in this tutorial.

On Error GoTo 0

‘On Error GoTo 0’ will stop the code on the line that causes the error and shows a message box that describes the error.

In simple terms, it enables the default error checking behavior and shows the default error message.

Then why even use it?

Normally, you don’t need to use ‘On Error Goto 0’, but it can be useful when you use it in conjunction with ‘On Error Resume Next’

The below code would select all the blank cells in the selection.

But it would show an error when there are no blank cells in the selected cells.

So to avoid showing the error, you can use On Error Resume next’

Now, it will also show any error when you run the below code:

The problem arises when there is a part of the code where error can occur, and since you’re using ‘On Error Resume Next’, the code would simply ignore it and move to the next line.

For example, in the below code, there would no error prompt:

In the above code, there are two places where an error can occur. The first place is where we are selecting all blank cells (using Selection.SpecialCells) and the second is in the remaining code.

While the first error is expected, any error after that is not.

This is where On Error Goto 0 comes to rescue.

When you use it, you reset the error setting to default, where it will start showing errors when it encounters it.

For example, in the below code, there would be no error in case there are no blank cells, but there would be an error prompt because of ’10/0′

On Error Goto [Label]

The above two methods – ‘On Error Resume Next’ and ‘On Error Goto 0’ – doesn’t allow us to truly handle the error. One makes the code ignore the error and the second one resume error checking.

On Error Go [Label] is a way with which you can specify what you want to do in case your code has an error.

Below is the code structure that uses this error handler:

Note that before the Error handling ‘Label’, there is an Exit Sub. This ensures that in case there are no errors, the sub is exited and the ‘Label’ code is not executed. In case you don’t use Exit Sub, it will always execute the ‘Label’ code.

In the example code below, when an error occurs, the code jumps and executes the code in the handler section (and shows a message box).

Note that when an error occurs, the code has already run and executed the lines before the line causing the error. In the above example, the code sets the value of X as 12, but since the error occurs in the next line, it doesn’t set the values for Y and Z.

Once the code jumps to the error handler code (ErrMsg in this example), it will continue to execute all the lines in and below the error handler code and the exit the sub.

On Error Goto -1

This one is a bit complicated, and in most cases, you’re unlikely to use this.

But I will still cover this as I have faced a situation where this was needed (feel free to ignore and jump to the next section if you’re only looking for basics).

Before I get into the mechanics of it, let me try and explain where can it be useful.

Suppose you have a code where an error is encountered. But all is good as you have one error handler in place. But what happens when there is another error in the error handler code (yeah.. somewhat like the inception movie).

In such a case, you can not use the second handler as the first error has not been cleared. So while you have handled the first error, in VBA’s memory it still exists. And the VBA memory only has a place for one error – not two or more than that.

In this scenario, you can use On Error Goto -1.

It clears the error and frees up VBA memory to handle the next error.

Let’s me explain now by using examples.

Suppose I have the below code. This will throw an error as there is division by zero.

So to handle it, I use an error handler code (with the name ErrMsg) as shown below:

All is good now again. As soon as the error occurs, the error handler is used and shows a message box as shown below.

Now, I expand the code so that I have more code in or after the error handler.

Since the first error has been handled but the second has not been, I again see an error as shown below.

Still all good. The code is behaving in the way we expected it to.

So to handle the second error, I use another error handler (ErrMsg2).

And this is where it doesn’t work as expected.

If you run the above code, it will still give you a run-time error, even after having the second error handler in place.

This happens as we didn’t clear the first error from VBA’s memory.

Yes, we handled it! But it still remains in the memory.

And when VBA encounters another error, it’s still stuck with the first error, and hence the second error handler is not used. The code stops at the line that caused the error and shows the error prompt.

To clear VBA’s memory and clear the previous error, you need to use the ‘On Error Goto -1’.

So if you add this line in the below code and run it, it will work as expected.

The Err Object

Whenever an error occurs with a code, it’s the Err object that is used to get the details about the error (such as the error number or the description).

Err Object Properties

The Err Object has the following properties:

Property Description
Number A number that represents the type of error. When there is no error, this value is 0
Description A short description of the error
Source Project name in which the error has occurred
HelpContext The help context id for the error in the help file
HelpFile A string that represents the folder location and the file name of the help file

While in most cases you don’t need to use Err object, it can sometimes be useful while handling errors in Excel.

For example, suppose you have a dataset as shown below and for each number, in the selection, you want to calculate the square root in the adjacent cell.

The below code can do it, but since there is a text string in cell A5, it shows an error as soon as this occurs.

The problem with this type of error message is that it gives you nothing about what has gone wrong and where the issue occurred.

You can use the Err object to make these error messages more meaningful.

For example, if I now use the below VBA code, it will stop the code as soon as the error occurs and show a message box with the cell address of the cell where there is an issue.

The above code would give you a lot more information than the simple ‘Type Mismatch’, especially the cell address so that you know where the error occurred.

You can further refine this code to make sure your code runs until the end (instead of breaking at each error) and then gives you a list of cell address where the error occurs.

The below code would do this:

The above code runs until the end and gives the square root of all the cells that have numbers in it (in the adjacent column). It then shows a message that lists all the cells where there was an error (as shown below):

Err Object Methods

While the Err properties are useful to show useful information about the errors, there are two Err methods as well that can help you with error handling.

Method Description
Clear Clears all the property settings of the Err object
Raise Generates a run-time error

Let’s quickly learn what these are and how/why to use these with VBA in Excel.

Err Clear Method

Suppose you have a dataset as shown below and you want to get the square root of all these numbers in the adjacent column.

The following code will get the square roots of all the numbers in the adjacent column and show a message that an error occurred for cell A5 and A9 (as these have text in it).

Note that I have used the Err.Clear method within the If Then statement.

Once an error has occurred and trapped by the If condition, Err.Clear method resets the error number back to 0. This ensures that IF condition only trap the errors for cells where it is raised.

Had I not used the Err.Clear method, once the error occurs, it would always be true in the IF condition, and the error number has not been reset.

Another way of making this work is by using the On Error Goto -1, which resets the error completely.

Err Raise Method

The Err.Raise method allows you to raise a run-time error.

Below is the syntax of using the Err.Raise method:

Err.Raise [number], [source], [description], [helpfile], [helpcontext]

All these arguments are optional and you can use these to make your error message more meaningful.

But why would you ever want to raise an error yourself?

You can use this method when there is an instance of an error (which means that there is going to an error anyway) and then you use this method to tell the user more about the error (instead of the less helpful error message that VBA shows by default).

For example, suppose you have a dataset as shown below and you want all the cells to have numeric values only.

The above code would show an error message that has the specified description and the context file.

Personally, I have never used Err.Raise as I mostly work with Excel only. But for someone who uses VBA to work with Excel along with other applications such as Outlook, Word or PowerPoint, this can be useful.

Here is a detailed article on Err.Raise method in case you want to learn more.

VBA Error Handling Best Practices

No matter how skilled you get a writing VBA code, errors are always going to be a part of it. The best coders are those who have the skills to handle these errors properly.

Here are some best practices you can use when it comes to error handling in Excel VBA.

  1. Use ‘On Error Go [Label]’ at the beginning of the code. This will make sure any error that can happen from there is handled.
  2. Use ‘On Error Resume Next’ ONLY when you’re sure about the errors that can occur. Use it with expected error only. In case you use it with unexpected errors, it will simply ignore it and move forward. You can use ‘On Error Resume Next’ with ‘Err.Raise’ if you want to ignore a certain type of error and catch the rest.
  3. When using error handlers, make sure you’re using Exit Sub before the handlers. This will ensure that the error handler code is executed only when there is an error (else it will always be executed).
  4. Use multiple error handlers to trap different kinds of errors. Having multiple error handler ensures that an error is properly addressed. For example, you would want to handle a ‘type mismatch’ error differently than a ‘Division by 0’ run-time error.

Hope you found this Excel article useful!

Here are some more Excel VBA Tutorials that you may like:

Источник

Compile error in a hidden module is an error message that may be shown for some Microsoft Word and Microsoft Excel users. This message is generally displayed when Office users open Word or Excel. After this message, the application does not launch.

Fix Compile error in hidden module in Excel or Word

This error occurs when the code is incompatible with the version or architecture of this application. For instance, if code in a document targets 32-bit Microsoft Office applications but it is attempting to run on 64-bit Office, then this error can occur.

Says Microsoft.

The error is raised when a compilation error exists in the VBA code inside a protected (hidden) module. The specific compilation error is not exposed because the module is protected.

Try the following suggestions to fix the issue:

  1. Unprotect the VBA code module
  2. Re-registering OCX files with the Command Prompt
  3. Updating Adobe Acrobat
  4. Moving PDfmaker files to another folder
  5. Updating or Uninstalling the Norton Antivirus software

Let us look at these ways in more detail.

Compile error in hidden module

1] Unprotect the VBA code module

Now, if you are facing this error, do the following:

  • If you have access to the VBA code in the document or project, unprotect the module, and then run the code again to view the specific error.
  • If you don’t have access to the VBA code in the document, then contact the document author to have the code in the hidden module updated.

This is the official workaround. If that does not help, try the following suggestions:

2] Reregistering OCX files with the Command Prompt

The compile error in hidden module error could also be a side effect of Windows updates. Hence, registering a mscomctl.ocx file may fix the issue. To reregister the OCX file, follow the given steps:

Press Windows + X hotkey. Choose Command Prompt (Admin) to run the prompt as an administrator.

In the case of a 32-bit Windows computer, provide the following commands in the prompt:

regsvr32 -u c:windowssystem32mscomctl.ocx
regsvr32 c:windowssystem32mscomctl.ocx

In the case of a 64-bit Windows computer, provide the following commands in the prompt:

regsvr32 -u c:windowssyswow64mscomctl.ocx
regsvr32 c:windowssyswow64mscomctl.ocx

3] Updating Adobe Acrobat

This applies to you if you are using Adobe Acrobat.

The compile error in hidden module error could also occur due to two Adobe Acrobat template files in MS Office folders. It is advisable to install the Adobe software from an official website to avoid this error. In case you come across this error, you can export PDFs into other Microsoft 365 like Word, Excel, or PowerPoint. You can update Adobe by clicking on Help in Adobe’s window. Choose Check for Updates to open the updater window. You can then press the Download and Install button in case of any update.

4] Moving PDFmaker files to another folder

This applies to you if you are using PDFmaker

The compile error in hidden module error is connected to two Adobe Acrobat files i.e. PDFmaker.xla and PDFmaker.dot. Hence, moving these files out of the MS Office folders may also fix the error. You can also follow the below steps:

  • Press Type here to search button and open Cortana’s search box. Type PDfmaker.xla in the search box to look for that file.
  • Type PDFmaker.dot in the search box to look for the file. Right-click the said files and choose Open file location to open the folders in the File Explorer.
  • In case you cannot find the files, you can open the MS Office Start-up and Xlstart folders in the File Explorer.
  • Right-click on the files in the File Explorer and choose the Cut option to move the PDfmaker files to the desktop. Right-click another folder to move them and choose Paste.

5] Update or Uninstall the Norton Antivirus software

This applies to you if you are using Norton software

The Norton Antivirus may also be connected to compile error in hidden module error. If it is installed, updating the software can fix the issue. You can check for updates by pressing the Update Me Now button. You can right-click the Norton Antivirus system tray icon and choose Norton LiveUpdate.

In case a Norton Antivirus update does not fix the issue, you can uninstall the Norton software.

Press Windows + R shortcut to open the Run windows.  Type appwiz.cpl in Run, and click on the OK button. Choose the listed Norton Antivirus software and click on the Uninstall button to remove the software after confirmation.

We hope that one of the above-mentioned solutions helps you fix the compile error in hidden module error and re-launch Word and Excel. Do let us know in case of any queries or suggestions.

How do I open Excel in safe mode?

You can open Excel in safe mode by pressing and holding the Ctrl button as you start the program. You can also use the safe switch (excel.exe/safe) when you start the program from the command line.

Fix: The file is corrupt and cannot be opened error in Word, Excel, PowerPoint

What is the safe mode in Microsoft Word?

When you cannot use Microsoft Office normally, you can use a built-in safety feature. If Word or Excel crashes every time you open it, you can start the said application in safe mode and it helps you work normally.

No matter how experienced you’re with VBA coding, errors are always going to be a part of it.

The difference between a novice and an expert VBA programmer is that the expert programmers know how to effectively handle and use errors.

In this tutorial, I will show you various ways you can use to handle errors effectively in Excel VBA.

Before we get into VBA error handling, let’s first understand the different types of errors you are likely to encounter when programming in Excel VBA.

Types of VBA Errors in Excel

There are four types of errors in Excel VBA:

  1. Syntax errors
  2. Compilation errors
  3. Runtime errors
  4. Logical Errors

Let’s quickly understand what these errors are and when you’re likely to encounter these.

Syntax Error

A syntax error, as the name suggests, occurs when VBA finds something wrong with the syntax in the code.

For example, if you forget a part of the statement/syntax that is needed, then you will see the compile error.

In the below code, as soon as I hit enter after the second line, I see a compile error. This is because the IF statement needs to have the ‘Then‘ command, which is missing in the below code.

Excel VBA Compile Error - Expected Then or Goto

Note: When you are typing a code in Excel VBA, it checks for each sentence as soon as you hit enter. If VBA finds something missing in the syntax, it instantly shows a message with some text that can help you understand the missing part.

To make sure you see the syntax error whenever there is something missing, you need to make sure Autosyntax check is enabled. To do this, click on ‘Tools’ and then click on ‘Options’. In the options dialog box, make sure that the ‘Auto Syntax Check’ option is enabled.

AutoSyntax Option to be checked

If the ‘Auto Syntax Check’ option is disabled, VBA will still highlight the line with the syntax error in red, but it will not show the error dialog box.

Compile Error

Compile errors occur when something is missing that is needed for the code to run.

For example, in the below code, as soon as I try to run the code, it will show the following error. This happens as I have used the IF Then statement without closing it with the mandatory ‘End If’.

Excel VBA Error - Block If Without End If

A syntax error is also a type of compile error. A syntax error occurs as soon as you hit enter and VBA identifies that something is missing. A compilation error can also occur when VBA doesn’t find anything missing while typing the code, but it does when the code is compiled or executed.

VBA checks each line as you’re typing the code and highlights the syntax error as soon as the line is incorrect and you hit enter. Compile errors, on the other hand, are only identified when the entire code is analyzed by VBA.

Below are some scenarios where you’ll encounter the compile error:

  1. Using an IF Statement without the End IF
  2. Using For statement with the Next
  3. Using Select statement without using the End Select
  4. Not declaring the variable (this works only when Option Explicit is enabled)
  5. Calling a Sub/Function that does not exist (or with wrong parameters)

Note about ‘Option Explicit’: When you add ‘Option Explicit’, you will be required to declare all the variables before running the code. If there is any variable that has not been declared, VBA would show an error. This is a good practice as it shows an error in case you have a misspelled variable. You can read more about Option Explicit here.

Run Time Errors

Runtime errors are those that occur when the code is running.

Run time errors will occur only when all the syntax and compile errors are being taken care of.

For example, if you run code that is supposed to open an Excel workbook, but that workbook is unavailable (either deleted or name changed), your code would give you a runtime error.

Runtime error in Excel VBA

When a runtime error occurs, it will stop the code and show you the error dialog box.

The message in the Run-time error dialog box is a little more helpful. It tries to explain the problem that can help you correct it.

If you click on the Debug button, it will highlight the part of the code that is leading to the error.

Click on Debug to Highlight the code

If you have corrected the error, you can click on the Run button in the toolbar (or press F5) to continue running the code from where it left.

Or you can also click on the End button to come out of the code.

Important: In case you click the End button in the dialog box, it will stop the code at the line at which is encountered. However, all the lines of code before that would have been executed.

Logical Errors

Logical errors would not make your code stop but can lead to wrong results. These could also be the most difficult types of errors to troubleshoot.

These errors are not highlighted by the compiler and need to be manually tackled.

One example of logical error (that I often find myself stuck with) is running into an endless loop.

Another example could be when it gives a result which is wrong. For example, you may end up using a wrong variable in the code or add two variables where one is incorrect.

There are a few ways I use to tackle logical errors:

  1. Insert Message Box at some place in the code and highlight values/data that can help understand if eberything is going as expected.
  2. Instead of running the code at one go, go through each line one by one. To do this, click anywhere in the code and press F8. you would notice that each time you press F8, one line gets executed. This allows you to go through the code one line at a time and identify the logical errors.

Using Debug to Find Compile/Syntax Errors

Once you’re done with the code, it’s a good practice to first compile it before running.

To compile a code, click on the Debug option in the toolbar and click on Compile VBAProject.

Debug Compile VBAProject

When you compile a VBA project, it goes through the code and identifies errors (if any).

In case it finds an error, it will show you a dialog box with the error. It finds errors one by one. So if it finds an error and you have corrected it, you need to run compile again to find other errors (if there are).

When you’re code is free of errors, the Compile VBAProject option will be greyed out.

Note that Compiling will only find ‘Syntax’ errors and ‘Compile’ errors. It will NOT find the run-time errors.

When you’re writing VBA code, you don’t want the errors to crop up. To avoid this, there are many error-handling methods you can use.

In the next few sections of this article, I will be covering the methods you can use for VBA error handling in Excel.

Configure Error Settings (Handled Vs Unhandled Errors)

Before you start working with your code, you need to check for one setting in Excel VBA.

Go to the VBA toolbar and click on Tools and then click on Options.

In the Options dialog box, click on the General tab and make sure that within the ‘Error Trapping’ group, ‘Break on Unhandled Errors’ is checked.

Let me explain the three options:

  1. Break on All Errors: This will stop your code on all types of errors, even when you have used the techniques to handle these errors.
  2. Break in Class Module: This will stop your code on all unhandled errors, and at the same time, if you’re using objects such as Userforms, it will also break within those objects and highlight the exact line causing the error.
  3. Break on Unhandled Errors: This will stop your code only for those errors that are not handled. This is the default setting as it ensures any unhandled errors are brought to your notice. If you’re using objects such as Userforms, this will not highlight the line causing the error in the object, but will only highlight the line that’s referring to that object.

Note: If you work with objects such as Userforms, you can change this setting to ‘Break on Class Modules’. The difference between #2 and #3 is that when you use Break in Class Module, it will take you to the specific line in the object that is causing the error. You can also choose to go with this instead of ‘Break on Unhandled Errors’.

So in a nutshell – if you’re just starting with Excel VBA, ensure ‘Break on Unhandled Errors’ is checked.

VBA Error Handling with ‘On Error’ Statements

When your code encounters an error, there are a few things you can do:

  1. Ignore the error and let the code continue
  2. Have an error handling code in place and run it when an error occurs

Both of these error handling methods ensures that the end user will not get to see an error.

There are a few ‘On Error’ statements that you can use to get these done.

On Error Resume Next

When you use ‘On Error Resume Next’ in your code, any encountered error will be ignored and the code will continue to run.

This error handling method is used quite often, but you need to be cautious when using it. Since it completely ignores any error that may occur, you may not be able to identify the errors that need to be corrected.

For example, if the below code is run, it will return an error.

Sub AssignValues()
x = 20 / 4
y = 30 / 0
End Sub

This happens because you can not divide a number by zero.

But if I use the ‘On Error Resume Next’ statement in this code (as shown below), it will ignore the error and I will not know that there is an issue that needs to be corrected.

Sub AssignValues()
On Error Resume Next
x = 20 / 4
y = 30 / 0
End Sub

On Error Resume Next should be used only when you clearly know the kind of errors your VBA code is expected to throw and it’s alright to ignore it.

For example, below is the VBA event code that would instantly add the date and time value in cell A1 of a newly inserted sheet (this code is added in the worksheet and not in a module).

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Sh.Range("A1") = Format(Now, "dd-mmm-yyyy hh:mm:ss")
End Sub

While this works great in most cases, it would show an error if I add a chart sheet instead of a worksheet. Since a chart sheet does not have cells, the code would throw an error.

So, if I use the ‘On Error Resume Next’ statement in this code, it will work as expected with worksheets and do nothing with chart sheets.

Private Sub Workbook_NewSheet(ByVal Sh As Object)
On Error Resume Next
Sh.Range("A1") = Format(Now, "dd-mmm-yyyy hh:mm:ss")
End Sub

Note: On Error Resume Next Statement is best used when you know what kind of errors you’re likely to encounter. And then if you think it’s safe to ignore these errors, you can use it.

You can take this code to the next level by analyzing if there was an error, and displaying a relevant message for it.

The below code would show a message box that would inform the user that a worksheet has not been inserted.

Private Sub Workbook_NewSheet(ByVal Sh As Object)
On Error Resume Next
Sh.Range("A1") = Format(Now, "dd-mmm-yyyy hh:mm:ss")
If Err.Number <> 0 Then
MsgBox "Looks like you inserted a chart sheet" & vbCrLf & "Error - " & Err.Description
End If
End Sub

‘Err.Number’ is used to get the error number and ‘Err.Description’ is used to get the error description. These will be covered later in this tutorial.

On Error GoTo 0

‘On Error GoTo 0’ will stop the code on the line that causes the error and shows a message box that describes the error.

In simple terms, it enables the default error checking behavior and shows the default error message.

Then why even use it?

Normally, you don’t need to use ‘On Error Goto 0’, but it can be useful when you use it in conjunction with ‘On Error Resume Next’

Let me explain!

The below code would select all the blank cells in the selection.

Sub SelectFormulaCells()
Selection.SpecialCells(xlCellTypeBlanks).Select
End Sub

But it would show an error when there are no blank cells in the selected cells.

So to avoid showing the error, you can use On Error Resume next’

Now, it will also show any error when you run the below code:

Sub SelectFormulaCells()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).Select
End Sub

So far, so good!

The problem arises when there is a part of the code where error can occur, and since you’re using ‘On Error Resume Next’, the code would simply ignore it and move to the next line.

For example, in the below code, there would no error prompt:

Sub SelectFormulaCells()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).Select
' .. more code that can contain error
End Sub

In the above code, there are two places where an error can occur. The first place is where we are selecting all blank cells (using Selection.SpecialCells) and the second is in the remaining code.

While the first error is expected, any error after that is not.

This is where On Error Goto 0 comes to rescue.

When you use it, you reset the error setting to default, where it will start showing errors when it encounters it.

For example, in the below code, there would be no error in case there are no blank cells, but there would be an error prompt because of ’10/0′

Sub SelectFormulaCells()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).Select
On Error GoTo 0
' .. more code that can contain error
End Sub

Error Checking restored with GoTo 0

On Error Goto [Label]

The above two methods – ‘On Error Resume Next’ and ‘On Error Goto 0’ – doesn’t allow us to truly handle the error. One makes the code ignore the error and the second one resume error checking.

On Error Go [Label] is a way with which you can specify what you want to do in case your code has an error.

Below is the code structure that uses this error handler:

Sub Test()

On Error GoTo Label:
X = 10 / 0    'this line causes an error
' ....your remaining code goes here
Exit Sub

Label:
    ' code to handle the error
End Sub

Note that before the Error handling ‘Label’, there is an Exit Sub. This ensures that in case there are no errors, the sub is exited and the ‘Label’ code is not executed. In case you don’t use Exit Sub, it will always execute the ‘Label’ code.

In the example code below, when an error occurs, the code jumps and executes the code in the handler section (and shows a message box).

Sub Errorhandler()
On Error GoTo ErrMsg
X = 12
Y = 20 / 0
Z = 30
Exit Sub
ErrMsg:
MsgBox "There seems to be an error" & vbCrLf & Err.Description
End Sub

Note that when an error occurs, the code has already run and executed the lines before the line causing the error. In the above example, the code sets the value of X as 12, but since the error occurs in the next line, it doesn’t set the values for Y and Z.

Once the code jumps to the error handler code (ErrMsg in this example), it will continue to execute all the lines in and below the error handler code and the exit the sub.

On Error Goto -1

This one is a bit complicated, and in most cases, you’re unlikely to use this.

But I will still cover this as I have faced a situation where this was needed (feel free to ignore and jump to the next section if you’re only looking for basics).

Before I get into the mechanics of it, let me try and explain where can it be useful.

Suppose you have a code where an error is encountered. But all is good as you have one error handler in place. But what happens when there is another error in the error handler code (yeah.. somewhat like the inception movie).

In such a case, you can not use the second handler as the first error has not been cleared. So while you have handled the first error, in VBA’s memory it still exists. And the VBA memory only has a place for one error – not two or more than that.

In this scenario, you can use On Error Goto -1.

It clears the error and frees up VBA memory to handle the next error.

Enough talk!

Let’s me explain now by using examples.

Suppose I have the below code. This will throw an error as there is division by zero.

Sub Errorhandler()
X = 12
Y = 20 / 0
Z = 30
End Sub

So to handle it, I use an error handler code (with the name ErrMsg) as shown below:

Sub Errorhandler()

On Error GoTo ErrMsg

X = 12
Y = 20 / 0
Z = 30
Exit Sub

ErrMsg:
MsgBox "There seems to be an error" & vbCrLf & Err.Description
End Sub

Division by 0 error message

All is good now again. As soon as the error occurs, the error handler is used and shows a message box as shown below.

Now, I expand the code so that I have more code in or after the error handler.

Sub Errorhandler()

On Error GoTo ErrMsg

X = 12
Y = 20 / 0
Z = 30
Exit Sub

ErrMsg:
MsgBox "There seems to be an error" & vbCrLf & Err.Description
A = 10 / 2
B = 35 / 0
End Sub

Since the first error has been handled but the second has not been, I again see an error as shown below.

Second Division by error code

Still all good. The code is behaving in the way we expected it to.

So to handle the second error, I use another error handler (ErrMsg2).

Sub Errorhandler()

On Error GoTo ErrMsg

X = 12
Y = 20 / 0
Z = 30
Exit Sub

ErrMsg:
MsgBox "There seems to be an error" & vbCrLf & Err.Description
On Error GoTo ErrMsg2
A = 10 / 2
B = 35 / 0
Exit Sub

ErrMsg2:
MsgBox "There seems to be an error again" & vbCrLf & Err.Description

End Sub

And this is where it doesn’t work as expected.

If you run the above code, it will still give you a run-time error, even after having the second error handler in place.

This happens as we didn’t clear the first error from VBA’s memory.

Yes, we handled it! But it still remains in the memory.

And when VBA encounters another error, it’s still stuck with the first error, and hence the second error handler is not used. The code stops at the line that caused the error and shows the error prompt.

To clear VBA’s memory and clear the previous error, you need to use the ‘On Error Goto -1’.

So if you add this line in the below code and run it, it will work as expected.

Sub Errorhandler()

On Error GoTo ErrMsg
X = 12
Y = 20 / 0
Z = 30
Exit Sub

ErrMsg:
MsgBox "There seems to be an error" & vbCrLf & Err.Description
On Error GoTo -1
On Error GoTo ErrMsg2
A = 10 / 2
B = 35 / 0
Exit Sub

ErrMsg2:
MsgBox "There seems to be an error again" & vbCrLf & Err.Description

End Sub

Note: The error automatically gets cleared when a subroutine ends. So, ‘On Error Goto -1’ can be useful when you’re getting two or more than two errors in the same subroutine.

The Err Object

Whenever an error occurs with a code, it’s the Err object that is used to get the details about the error (such as the error number or the description).

Err Object Properties

The Err Object has the following properties:

Property Description
Number A number that represents the type of error. When there is no error, this value is 0
Description A short description of the error
Source Project name in which the error has occurred
HelpContext The help context id for the error in the help file
HelpFile A string that represents the folder location and the file name of the help file

While in most cases you don’t need to use Err object, it can sometimes be useful while handling errors in Excel.

For example, suppose you have a dataset as shown below and for each number, in the selection, you want to calculate the square root in the adjacent cell.

Data for Square root in Excel

The below code can do it, but since there is a text string in cell A5, it shows an error as soon as this occurs.

Sub FindSqrRoot()
Dim rng As Range
Set rng = Selection

For Each cell In rng
    cell.Offset(0, 1).Value = Sqr(cell.Value)
Next cell

End Sub

Type Mismatch Error when finding square root

The problem with this type of error message is that it gives you nothing about what has gone wrong and where the issue occurred.

You can use the Err object to make these error messages more meaningful.

For example, if I now use the below VBA code, it will stop the code as soon as the error occurs and show a message box with the cell address of the cell where there is an issue.

Sub FindSqrRoot()
Dim rng As Range
Set rng = Selection

For Each cell In rng
    On Error GoTo ErrHandler
    cell.Offset(0, 1).Value = Sqr(cell.Value)
Next cell

ErrHandler:
MsgBox "Error Number:" & Err.Number & vbCrLf & _
    "Error Description: " & Err.Description & vbCrLf & _
    "Error at: " & cell.Address

End Sub

The above code would give you a lot more information than the simple ‘Type Mismatch’, especially the cell address so that you know where the error occurred.

More description Error when finding the square root

You can further refine this code to make sure your code runs until the end (instead of breaking at each error) and then gives you a list of cell address where the error occurs.

The below code would do this:

Sub FindSqrRoot2()
Dim ErrorCells As String
Dim rng As Range

On Error Resume Next

Set rng = Selection
For Each cell In rng
cell.Offset(0, 1).Value = Sqr(cell.Value)

If Err.Number <> 0 Then
ErrorCells = ErrorCells & vbCrLf & cell.Address
On Error GoTo -1
End If
Next cell
MsgBox "Error in the following cells" & ErrorCells
Exit Sub

End Sub

The above code runs until the end and gives the square root of all the cells that have numbers in it (in the adjacent column). It then shows a message that lists all the cells where there was an error (as shown below):

Shows a message with cell address that have errors

Err Object Methods

While the Err properties are useful to show useful information about the errors, there are two Err methods as well that can help you with error handling.

Method Description
Clear Clears all the property settings of the Err object
Raise Generates a run-time error

Let’s quickly learn what these are and how/why to use these with VBA in Excel.

Err Clear Method

Suppose you have a dataset as shown below and you want to get the square root of all these numbers in the adjacent column.

Data for Square root in Excel - 10 cells

The following code will get the square roots of all the numbers in the adjacent column and show a message that an error occurred for cell A5 and A9 (as these have text in it).

Sub FindSqrRoot2()
Dim ErrorCells As String
Dim rng As Range

On Error Resume Next

Set rng = Selection
For Each cell In rng
cell.Offset(0, 1).Value = Sqr(cell.Value)

If Err.Number <> 0 Then
ErrorCells = ErrorCells & vbCrLf & cell.Address
Err.Clear
End If
Next cell
MsgBox "Error in the following cells" & ErrorCells

End Sub

Note that I have used the Err.Clear method within the If Then statement.

Once an error has occurred and trapped by the If condition, Err.Clear method resets the error number back to 0. This ensures that IF condition only trap the errors for cells where it is raised.

Had I not used the Err.Clear method, once the error occurs, it would always be true in the IF condition, and the error number has not been reset.

Another way of making this work is by using the On Error Goto -1, which resets the error completely.

Note: Err.Clear is different from On Error Goto -1. Err.Clear only clears the error description and the error number. it doesn’t completely reset it. This means that if there is another instance of error in the same code, you won’t be able to handle it before resetting it (which can be done with ‘On Error Goto -1’ and not by ‘Err.Clear’).

Err Raise Method

The Err.Raise method allows you to raise a run-time error.

Below is the syntax of using the Err.Raise method:

Err.Raise [number], [source], [description], [helpfile], [helpcontext]

All these arguments are optional and you can use these to make your error message more meaningful.

But why would you ever want to raise an error yourself?

Good question!

You can use this method when there is an instance of an error (which means that there is going to an error anyway) and then you use this method to tell the user more about the error (instead of the less helpful error message that VBA shows by default).

For example, suppose you have a dataset as shown below and you want all the cells to have numeric values only.

Sub RaiseError()
Dim rng As Range
Set rng = Selection

On Error GoTo ErrHandler

For Each Cell In rng
If Not (IsNumeric(Cell.Value)) Then
Err.Raise vbObjectError + 513, Cell.Address, "Not a number", "Test.html"
End If
Next Cell

ErrHandler:
MsgBox Err.Description & vbCrLf & Err.HelpFile
End Sub

The above code would show an error message that has the specified description and the context file.

Personally, I have never used Err.Raise as I mostly work with Excel only. But for someone who uses VBA to work with Excel along with other applications such as Outlook, Word or PowerPoint, this can be useful.

Here is a detailed article on Err.Raise method in case you want to learn more.

VBA Error Handling Best Practices

No matter how skilled you get a writing VBA code, errors are always going to be a part of it. The best coders are those who have the skills to handle these errors properly.

Here are some best practices you can use when it comes to error handling in Excel VBA.

  1. Use ‘On Error Go [Label]’ at the beginning of the code. This will make sure any error that can happen from there is handled.
  2. Use ‘On Error Resume Next’ ONLY when you’re sure about the errors that can occur. Use it with expected error only. In case you use it with unexpected errors, it will simply ignore it and move forward. You can use ‘On Error Resume Next’ with ‘Err.Raise’ if you want to ignore a certain type of error and catch the rest.
  3. When using error handlers, make sure you’re using Exit Sub before the handlers. This will ensure that the error handler code is executed only when there is an error (else it will always be executed).
  4. Use multiple error handlers to trap different kinds of errors. Having multiple error handler ensures that an error is properly addressed. For example, you would want to handle a ‘type mismatch’ error differently than a ‘Division by 0’ run-time error.

Hope you found this Excel article useful!

Here are some more Excel VBA Tutorials that you may like:

  • Excel VBA Data Types – A Complete Guide
  • Excel VBA Loops – For Next, Do While, Do Until, For Each
  • Excel VBA Events – An Easy (and Complete) Guide
  • Excel Visual Basic Editor – How to Open and Use it in Excel

Compile error in the hidden module is an error message that is faced by many Microsoft users. This normally occurs during opening a document in Microsoft Word or Excel. If you are facing the same then don’t worry, we are here to guide you to the exact way how to fix this issue with some simple tricks. Let’s know first about the reason behind this error message.

compile error in hidden module excel

The Reasons behind Excel or Word Compile Error in Hidden Module

If you hear the reason, you will understand what you have done wrong and why you are seeing an error. The meaning of this compile error in the hidden module is, that you have upgraded your 32-bit version of Microsoft Office 2016 to a 64-bit version of Microsoft Office 2016. But some 32-bit add-ins are remaining in the upgraded version. So, whenever you will try to open a document the codes of that add-ins will conflict and be incompatible with the current version. Thus, it will show you the error message that you already have seen on your screen.

Several hidden modules may cause this problem such as thisworkbook, menuandtoolbar, hstbarpublic, aowd, etc. So, if you are finding a solution to this issue, then you are strongly encouraged to read and apply the methods below one by one.

The Solution to Compile Error in Hidden Module Excel or Word

As many users are facing the same issue they receive an error during opening a document in MS Word or Excel, we have pointed out some best ways to fix this issue. You can try the following methods to fix this problem:

  1. Upgrading The Adobe Acrobat
  2. Using the Command Prompt to Re-register the OCX file
  3. Moving the PDF Maker File
  4. Deleting the .exd File
  5. Updating the Norton Antivirus Software

Now, let’s see the methods in detail so that you can fix the mentioned issue with your MS Word or Excel.

1. Upgrading The Adobe Acrobat

There are chances that two template files of Adobe Acrobat contained in the MS Word folder can cause the compile error. It mostly happens when someone downloads the adobe acrobat from unknown sources. So, it is suggested to download the adobe acrobat from its official website. 

If you are using adobe acrobat which is downloaded from an official website and still facing the problem, then it is probably because your adobe acrobat program is out of date. Updating the Adobe Acrobat software can fix this error message with Excel. Here are the steps to follow to update the application:

  • Open the Adobe Acrobat app and click on Help from the title bar
  • Then click on Check for Updates
  • It will check for updates and take some moment to find
  • If it finds any update, then click Download and Install

After updating the application, restart your PC and check if the error is gone or not. If not, then try the next method that is given below.

2. Using the Command Prompt to Re-register the OCX file

As the error comes from the functions of basic files of MS Excel, the excel compile error can be fixed by re-registering the OCX file using the command prompt. Here are the instructions:

  • Launch the Command Prompt (CMD) as admin
  • Type commands according to your Operating System (OS) that are given below and don’t forget to press Enter after each command

For 32-bit Windows OS:

regsvr32 -u c:windowssystem32mscomctl.ocx

regsvr32 c:windowssystem32mscomctl.ocx

For 64-bit Windows OS:

regsvr32 -u c:windowssyswow64mscomctl.ocx

regsvr32 c:windowssyswow64mscomctl.ocx

Now check if this has fixed the compile error in the hidden module or not. If you find that excel is still having the issue remaining, then let’s try the next method.

3. Moving the PDF Maker File

If you are using any PDF maker software on your PC, then it can be a reason for compile error in the hidden module of excel. As we already have mentioned above two Adobe Acrobat files that are contained in the MS Office folder can bring up this error. The name of those two files is PDFmaker.xla and PDFmaker.dot. So, you need to move these two files from the MS Office folder to somewhere else to fix this problem. You can follow the steps below:

  • For each of the files PDFmaker.xla and PDFmaked.dot, search by the name of the file from your windows search option
  • After finding the file, right-click on it and choose Open file location
  • If you couldn’t find the file, then try searching them in MS Office Start-up and Xlstart folders
  • From the file location, right-click on the file and click on cut
  • Come to your desktop and paste it

Now after restarting your PC, check if the excel compiler is showing an error or not. If it still shows the error message, then follow the next method.

4. Deleting the .exd File

The files with the .exd extension are normally a control information cache file that is generated by the Microsoft office. It can be created by inserting an ActiveX control in an MS program. Hence, deleting this cache can fix the compile error issue. Here are the steps to follow:

  • Press the Windows key and R key simultaneously to open the Run box
  • Then, type %appdata% in the box and click OK
  • After reaching the AppData folder, navigate to Roaming > Microsoft > Forms
  • After that, find the .exd files named comctllib.exd and mscomctllib.exd
  • Now, delete these files and restart your PC

It is supposed to solve the compile error. If not, then follow the last way to fix it.

5. Updating the Norton Antivirus Software

If you use third-party software like the Norton Antivirus, then this method applies to you. 

The Norton Antivirus Software can be another reason for compiler error in the hidden module in excel. So, you can fix this issue by updating or re-installing this antivirus software. To update the software, follow the instruction below:

  • Go to the official website of The Norton and click Update Me Now
  • After downloading the update, install it and restart your PC

Now check if the issue is gone or not. If you face the error even after updating the Norton Antivirus, then you need to uninstall the software. For this, follow these instructions:

  • Open the Run command by pressing the Windows key and R key simultaneously
  • Type appwiz.cpl on the run box and click OK
  • Find the Norton Antivirus and click Uninstall

After uninstalling the software successfully, restart your PC and check if the excel is showing any error or not. Hopefully, it will not show any error after applying the methods that are mentioned above.

Frequently Asked Questions

How Do I Open Excel in Safe Mode?

To open Excel in safe mode, you need to press and hold the Ctrl key during opening the program. Also, you can start excel in safe mode by using the command prompt by typing this command excel.exe/safe.

What is the Safe Mode in Microsoft Word?

Safe mode is a built-in feature to run Microsoft Office in case you are unable to run it in the normal way. It helps you to work normally using the applications of MS Office such as MS Word, MS Excel, etc. In safe mode, the application will never crash. So if you are facing such a problem where MS Word or Excel is crashing every time you are trying to open it, then you can use the safe mode.

Conclusion

So that’s all about the fix to the compile error in the hidden module error message. We have put together all the best methods that have helped many other users to fix the same issue. I hope now you are able to fix this issue on your own by applying the methods that are given in this article.

Apart from this, feel free to share if you have any suggestions or queries in the comment section below.

В этой инструкции описано, как устранить проблему, когда при запуске надстройки «Парсер сайтов» появляется сообщение об ошибке компиляции такого вида:

Compile error in hidden module: mod_AACTIONS.
This error commonly occurs when code is incompatible with the version, platform, or architecture of this application. Click «Help» for information on how to correct this error.

Причины проблемы

Проблема чаще всего проявляется на Office 2013, и вызвана тем, что некоторые скриптовые элементы управления в Office 2013 считаются «устаревшими» по соображениям безопасности.
В надстройке «Парсер сайтов» проблема вызвана использованием компонента Web Browser на формах VBA.

Подробно о причинах проблемы (Kill Bit) и способах решения написано в статьях на сайте Microsoft: ссылка1, ссылка2.

Как проверить, действительно ли в вашем случае проблема именно эта:

  1. В меню Excel нажимаем Файл — Параметры — Настройка ленты, и включаем галочку для отображения вкладки «Разработчик»
  2. На ленте Excel на вкладке «Разработчик» нажимаем Вставить — Элементы ActiveX — Другие элементы управления (см. скриншот)
  3. В появившемся диалоговом окне ищем пункт «Microsoft Web Browser», и нажимаем ОК (см. скриншот)
  4. Рисуем мышкой прямоугольник на листе Excel.
    Если объект появился на листе (см. скриншот), то в вашем случае присутствует какая-то другая проблема (описанное в инструкции не поможет).
    Если же выскочило сообщение об ошибке «Вставка обьекта неосуществима» / «Cannot insert object», то в этой инструкции описан как раз ваш случай.

Как решить проблему с ошибкой компиляции:

  • запускаете (предварительно надо извлечь файл из архива) прикреплённый к статье файл VBA_WebBrowser_FixCompilationError.reg,
    на вопрос «Вы действительно хотите добавить информацию из этого файла в реестр» отвечаете «ДА»
  • перезапускаете Excel (если не поможет, то перезагружаете компьютер)

Содержимое файла VBA_WebBrowser_FixCompilationError.reg:

{8856F961-340A-11D0-A96B-00C04FD705A2} — идентификатор для компонента Web Browser Control

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice 15.0ClickToRunREGISTRYMACHINESoftwareWow6432Node MicrosoftOffice15.0CommonCOM Compatibility {8856F961-340A-11D0-A96B-00C04FD705A2}]
«Compatibility Flags»=dword:00000000

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice 16.0ClickToRunREGISTRYMACHINESoftware Wow6432NodeMicrosoftOffice16.0 CommonCOM Compatibility{8856F961-340A-11D0-A96B-00C04FD705A2}]
«Compatibility Flags»=dword:00000000

[HKEY_LOCAL_MACHINESOFTWAREWow6432Node MicrosoftOffice15.0 CommonCOM Compatibility {8856F961-340A-11D0-A96B-00C04FD705A2}]
«Compatibility Flags»=dword:00000000

[HKEY_LOCAL_MACHINESOFTWAREWow6432Node MicrosoftOffice16.0 CommonCOM Compatibility {8856F961-340A-11D0-A96B-00C04FD705A2}]
«Compatibility Flags»=dword:00000000

[HKEY_LOCAL_MACHINESOFTWAREMicrosoft OfficeCommonCOM Compatibility {00024512-0000-0000-C000-000000000046}]
«Compatibility Flags»=dword:00000000

[HKEY_LOCAL_MACHINESoftwareWow6432Node MicrosoftOfficeCommonCOM Compatibility {00024512-0000-0000-C000-000000000046}]
«Compatibility Flags»=dword:00000000

Последнее обновление: 13 июля 2020 г.


  • Вы уже сталкивались с ошибкой компиляции в скрытом модуле при использовании Word или Excel?
  • Не теряйте из-за этого сон – вот несколько простых исправлений, которые гарантированно восстановят ваши файлы в кратчайшие сроки.
  • Если вы часто имеете дело с файлами Word, вы можете добавить в закладки наш Центр устранения неполадок MS Word на всякий случай.
  • Не стесняйтесь изучить наши руководства по Microsoft Office и получить все решения, которые могут вам когда-либо понадобиться, в одном месте.

Чтобы исправить различные проблемы с ПК, мы рекомендуем Restoro PC Repair Tool: это программное обеспечение исправит распространенные компьютерные ошибки, защитит вас от потери файлов, вредоносных программ, сбоев оборудования и оптимизирует ваш компьютер для максимальной производительности. Решите проблемы с ПК и удалите вирусы прямо сейчас, выполнив 3 простых шага:

  1. Загрузите Restoro PC Repair Tool, который поставляется с запатентованными технологиями (патент доступен здесь ).
  2. Нажмите Начать сканирование, чтобы найти проблемы Windows, которые могут вызывать проблемы с ПК.
  3. Нажмите «Восстановить все», чтобы исправить проблемы, влияющие на безопасность и производительность вашего компьютера.
  • В этом месяце Restoro скачали 668 476 читателей.

Ошибка компиляции в скрытом модуле – это сообщение об ошибке, которое может появиться у некоторых пользователей MS Word и Excel.

Сообщение об ошибке обычно появляется, когда пользователи Office открывают Word или Excel. Следовательно, ни одно приложение не запускается.

Появляется ли сообщение об ошибке компиляции в скрытом модуле при открытии Excel или Word? Если да, то вот несколько решений, которые могут это исправить.

Как исправить ошибки компиляции в Word / Excel?

  1. Обновите Adobe Acrobat
  2. Запустите Stellar Repair for Excel
  3. Переместить файлы Pdfmaker в другую папку
  4. Повторно зарегистрируйте файлы OCX с помощью командной строки
  5. Обновите антивирусное программное обеспечение Norton
  6. Удалить программное обеспечение Norton

1 Обновите Adobe Acrobat

ИСПРАВЛЕНИЕ: Ошибка компиляции в скрытом модуле в Word и Excel

Ошибка компиляции в скрытом модуле может быть связана с двумя файлами шаблонов Adobe Acrobat в папках MS Office. Таким образом, обновление Adobe Acrobat – одно из возможных решений проблемы.

Также крайне важно запускать программное обеспечение из надежного источника, поэтому мы настоятельно рекомендуем вам устанавливать Acrobat только с его официального сайта.

Acrobat – это мощный пакет для редактирования, тесно связанный с форматами файлов Microsoft Office, что делает его полностью цифровым.

Фактически, нет необходимости начинать заново, если вы столкнулись с ошибкой, вы можете быстро экспортировать PDF-файлы в другие Microsoft 365, такие как Word, Excel или Powerpoint.

Давайте быстро рассмотрим его ключевые особенности :

  • Упрощенные рабочие процессы на любой платформе – от настольных компьютеров до мобильных устройств и Интернета.
  • Конвертируйте PDF в форматы Microsoft 365
  • Расширенные инструменты совместной работы для обмена, просмотра и подписания документов на разных устройствах
  • Редактировать данные в отсканированных таблицах и преобразовывать формы в заполняемые формы
  • Мощный набор инструментов для редактирования (объединение, преобразование, удаление, поворот, обрезка и т.д. )

Чтобы вручную проверить наличие обновлений Adobe, щелкните «Справка» в окне Acrobat.

Выберите Проверить наличие обновлений, чтобы открыть окно средства обновления. Затем вы можете нажать кнопку «Загрузить и установить», если для нее есть обновления.

Загрузите Adobe Acrobat для Windows здесь


Word Online не работает или не отвечает? Вот как это исправить с помощью нескольких простых настроек.


2 Запустите Stellar Repair for Excel

ИСПРАВЛЕНИЕ: Ошибка компиляции в скрытом модуле в Word и Excel

Никакая ошибка не подходит для этого мощного инструмента, и ошибка компиляции в скрытом модуле не является исключением. Stellar Repair – это лучшая программа для восстановления Excel, защищающая данные вашей книги от повреждения и безвозвратной потери.

Запустите сканирование системы, чтобы обнаружить потенциальные ошибки

Нажмите Начать сканирование, чтобы найти проблемы с Windows.

Нажмите «Восстановить все», чтобы исправить проблемы с запатентованными технологиями.

Запустите сканирование ПК с помощью Restoro Repair Tool, чтобы найти ошибки, вызывающие проблемы с безопасностью и замедление. После завершения сканирования в процессе восстановления поврежденные файлы заменяются новыми файлами и компонентами Windows.

Stellar Repair for Excel исправляет серьезно поврежденные файлы .XLS / .XLSX с высочайшей степенью точности и восстанавливает все данные в исходное состояние, сохраняя при этом все свойства и форматирование.

Давайте быстро рассмотрим его ключевые особенности :

  • Восстановите поврежденные файлы Excel и восстановите исходное форматирование, макет и спецификации
  • Лаконичный, интуитивно понятный интерфейс со встроенным пошаговым мастером и рекомендациями по ремонту
  • Параметры простого поиска и поиска для быстрого поиска файлов и папок
  • Функция предварительного просмотра перед восстановлением в реальном времени
  • Полностью совместим с Windows 10, 8.1, 8, 7, Vista и XP
  • Поддерживает версии Microsoft Excel 2019, 2016, 2013, 2010, 2007, 2003 и 2000.
  • Мощный набор инструментов для восстановления данных (включая таблицы, диаграммы, комментарии к ячейкам, формулы и фильтры)

3 Перемещение файлов Pdfmaker в другую папку

Pdfmaker.xla и Pdfmaker.dot – это два файла Adobe Acrobat, связанные с ошибкой компиляции в скрытом модуле. Таким образом, перемещение этих файлов из папок MS Office также может исправить ошибку.

Вот как вы можете переместить эти файлы в альтернативную папку в Windows 10.

  • Нажмите кнопку «Введите здесь для поиска», чтобы открыть окно поиска Кортаны.
  • Введите Pdfmaker.xla в поле поиска, чтобы найти этот файл.
  • Чтобы найти Pdfmaker.dot, введите этот заголовок файла в поле поиска.
  • Затем щелкните файлы правой кнопкой мыши и выберите «Открыть расположение файлов», чтобы открыть соответствующие папки в проводнике.
  • Если вы не можете найти эти файлы с помощью инструмента поиска, откройте папки MS Office Startup и Xlstart в проводнике. Папка Startup включает Pdfmaker.dot, а каталог Xlstart включает Pdfmaker.xla.
  • Чтобы переместить файлы Pdfmaker на рабочий стол, щелкните их правой кнопкой мыши в проводнике и выберите параметр «Вырезать».
  • Щелкните правой кнопкой мыши другую папку (или рабочий стол Windows), чтобы переместить их, и выберите «Вставить».

4 Повторно зарегистрируйте файлы OCX с помощью командной строки

Ошибка компиляции в скрытом модуле также может быть побочным эффектом обновлений Windows. Таким образом, регистрация файла mscomctl.ocx также может решить проблему. Вот как вы можете повторно зарегистрировать этот файл OCX в командной строке.

  • Нажмите клавишу Windows + горячую клавишу X.
  • Выберите Командная строка (администратор), чтобы открыть ее от имени администратора.
  • Для 32-разрядной платформы Windows введите следующие команды в подсказке:

regsvr32 -u c:windowssystem32mscomctl.ocx
regsvr32 c:windowssystem32mscomctl.ocx

ИСПРАВЛЕНИЕ: Ошибка компиляции в скрытом модуле в Word и Excel

  • На 64-битных платформах Windows введите следующие команды:

regsvr32 -u c:windowssyswow64mscomctl.ocx
regsvr32 c:windowssyswow64mscomctl.ocx


Excel не открывает файлы? Ознакомьтесь с этим замечательным руководством, чтобы избавиться от этого белого экрана в кратчайшие сроки.


5 Обновите антивирусное программное обеспечение Norton

Norton Antivirus также связан с ошибкой компиляции в скрытом модуле. Если Norton AV установлен на вашем настольном компьютере или ноутбуке, обновление этого программного обеспечения может решить проблему.

Вы можете проверить наличие обновлений, нажав кнопку «Обновить сейчас» на этой веб-странице. Либо щелкните правой кнопкой мыши значок Norton Antivirus на панели задач и выберите Norton LiveUpdate.

6 Удаление программного обеспечения Norton

  • Если обновление Norton Antivirus не устраняет ошибку скрытого модуля, рассмотрите возможность удаления программного обеспечения Norton. Для этого нажмите сочетание клавиш Windows + R.
  • Введите «appwiz.cpl» в «Выполнить» и нажмите кнопку «ОК».

ИСПРАВЛЕНИЕ: Ошибка компиляции в скрытом модуле в Word и Excel

  • Выберите перечисленное программное обеспечение Norton Antivirus и нажмите его кнопку «Удалить».

  • Затем нажмите Да, чтобы удалить программное обеспечение.

    • *

Одно из этих решений для ошибки компиляции в ошибке скрытого модуля может запустить Word или Excel, чтобы вы могли запустить их снова.

Некоторые из более общих советов в этом посте по исправлению приложений MS Office, которые не открываются, также могут пригодиться для устранения проблемы со скрытым модулем.

Сообщите нам, какой из них сработал для вас, в разделе комментариев ниже.

Примечание редактора: этот пост был первоначально опубликован в августе 2018 года и с тех пор был переработан и обновлен в июле 2020 года для обеспечения свежести, точности и полноты.

Источник записи: windowsreport.com

When talking about MS Office error messages, it’s always a long story. Users would report hundreds of different error messages they received when they open Word, Excel, or PowerPoint. For some common errors like Runtime Error 1004 or add-in template is not valid, we have already introduced how can you fix them. This time, we will talk about another error message — Compile error in hidden module.

Users often received this error message when they start Excel. In rare times, when users start MS Word, this error would also pop up. Usually, users would see one of the following error messages:

  • Compile error in hidden module: AutoExec
  • Compile error in hidden module: AutoExecNew
  • Compile error in hidden module: DistMon

Compile error in hidden module

The different suffixes indicate that you have different culprits to blame, and that’s why there is more than one solution for you to solve the problem. Before checking the solutions, you should know the reasons why you see these error messages.

Why Do I See the Error Message of Compile Error in Hidden Module?

Now Office 2016 is upgraded from a 32-bit version to a 64-bit version. The Compile error in hidden module error message usually appears when there are dome 32-bit add-ins versions of the office in your computer, and they are incompatible with the 64-bit version.

Two common conditions that would cause this error are as follow:

1. When MS Excel startup folder contains both the following two template files on Adobe Acrobat PDF Maker add-in:

  • Pdfmaker.dot
  • Pdfmaker.xla

2. Your computer has installed the Norton Anti-virus software.

After knowing what causes this error message, now it’s time to apply the solutions. Here we have listed four solutions, you can try them one by one until you solve the problem.

Method 1. Re-register OCX Files with CMD

The first solution you can try is to re-register some basic Excel function files. In this method, we need to apply Windows Command Prompt.

Step 1. Press Windows + R keys at the same time. Type cmd in the run box.

Open cmd in Run box

Step 2. Type the following command and press Enter.

For 32-bit:

regsvr32 -u c:windowssystem32mscomctl.ocx

regsvr32 c:windowssystem32mscomctl.ocx

For 64-bit:

regsvr32 -u c:windowssystem64mscomctl.ocx

regsvr32 c:windowssystem64mscomctl.ocx

Step 3. Now run MS Excel again to check if the error message still exists.

Method 2. Delete .exd Files

The exd file is a control information cache file of Microsoft Office. These files are created when a user inserts an ActiveX control into a document using the Control Toolbox in an MS Office program. You can delete this cache file to see if it can fix the Compile error in the hidden module error.

Step 1. Press Windows + R keys at the same time. Type %appdata% in the run box.

Step 2. It will open your AppData folder. Go to Roaming > Microsoft > Forms.

Step 3. Find the .exd files, select comctllib.exd and mscomctllib.exd, and delete these two files.

Step 4. Restart your Excel and check if the problem is solved.

Method 3. Move PDF Maker Files

As we have mentioned above, one of the reasons you will see this error message is because there are two template files on Adobe Acrobat PDF Maker add-in. So in this method, you can move the PDF Maker files to another place to fix your problem. Here are the detailed steps.

Step 1. Open Windows File Explorer, search pdfmaker.* on your computer.

Step 2. Choose the pdfmaker.dot and pdfmaker.xla files, right-click on both files, and select cut.

Step 3. Paste these two files to your Desktop.

Now you can restart the MS Excel to see if the problem is solved.

Method 4. Update to the Latest Adobe Acrobat

If the above methods can’t help you solve the Compile error in hidden module problem, the last resort is to update the Adobe Acrobat to the latest version. It’s because this problem is associated with the Adobe Acrobat that is installed on your computer.

Go to the Adobe official website, find the latest version of Acrobat, download and install it on your computer.

related articles

How to Fix Word Runtime Error 91?

A runtime error is a common program error that usually occurs in Microsoft Office software. This article will you what is the reason for this error, and how to fix it.

runtime error 91

Bonus Solution: Repair Damaged or Corrupted MS Excel Efficiently

With the above methods, you might have solved the Excel Compile error in the hidden module issue. Then we’d like to share a good bonus tool — EaseUS Data Recovery Wizard with you. 

This is an advanced 4-in-1 specialized fix tool that enables you to repair corrupted  PDF documents and Office files in multiple formats. If your documents got damaged, Stellar file repair software will scan and repair them efficiently. 

If you want to try on this file repair software, you can download it and follow the guide to see how to use this tool. In the following guide, we have introduced how to repair Excel documents.

Step 1. Launch EaseUS Data Recovery Wizard. Select a disk location where the corrupted files are saved. Click «Scan» to start finding the broken files. EaseUS file repair tool allows you to fix damaged documents, videos, and pictures in differnet formats. 

select a location and click scan

Step 2. After scanning, you can quickly find corrupt data by file type. If you want to repair damaged Word, Excel, or PDF, select Documents and filter a specific category. For pictures and videos repair, all the common types are suppored, including JPEG, PNG, BMP, MOV, MP4, GIF, and more.

check scanned corrupt files

Step 3. EaseUS file repair software will automatically fix broken files. You can preview the repaired files before recovery. Last, click «Recover» and save the recovered files to a different location to avoid data overwriting.

recover and repair corrupted files

The Bottom Line

That’s all about Compile error in hidden module error message. Hope you can fix your problem after reading this article. Once again, we’d like to introduce EaseUS file repair tool. No matter whether you need to repair Word, Excel, PPT, or PDF documents, applying this tool is a wise choice.

When talking about MS Office error messages, it’s always a long story. Users would report hundreds of different error messages they received when they open Word, Excel, or PowerPoint. For some common errors like Runtime Error 1004 or add-in template is not valid, we have already introduced how can you fix them. This time, we will talk about another error message — Compile error in hidden module.

Users often received this error message when they start Excel. In rare times, when users start MS Word, this error would also pop up. Usually, users would see one of the following error messages:

  • Compile error in hidden module: AutoExec
  • Compile error in hidden module: AutoExecNew
  • Compile error in hidden module: DistMon

Compile error in hidden module

The different suffixes indicate that you have different culprits to blame, and that’s why there is more than one solution for you to solve the problem. Before checking the solutions, you should know the reasons why you see these error messages.

Why Do I See the Error Message of Compile Error in Hidden Module?

Now Office 2016 is upgraded from a 32-bit version to a 64-bit version. The Compile error in hidden module error message usually appears when there are dome 32-bit add-ins versions of the office in your computer, and they are incompatible with the 64-bit version.

Two common conditions that would cause this error are as follow:

1. When MS Excel startup folder contains both the following two template files on Adobe Acrobat PDF Maker add-in:

  • Pdfmaker.dot
  • Pdfmaker.xla

2. Your computer has installed the Norton Anti-virus software.

After knowing what causes this error message, now it’s time to apply the solutions. Here we have listed four solutions, you can try them one by one until you solve the problem.

Method 1. Re-register OCX Files with CMD

The first solution you can try is to re-register some basic Excel function files. In this method, we need to apply Windows Command Prompt.

Step 1. Press Windows + R keys at the same time. Type cmd in the run box.

Open cmd in Run box

Step 2. Type the following command and press Enter.

For 32-bit:

regsvr32 -u c:windowssystem32mscomctl.ocx

regsvr32 c:windowssystem32mscomctl.ocx

For 64-bit:

regsvr32 -u c:windowssystem64mscomctl.ocx

regsvr32 c:windowssystem64mscomctl.ocx

Step 3. Now run MS Excel again to check if the error message still exists.

Method 2. Delete .exd Files

The exd file is a control information cache file of Microsoft Office. These files are created when a user inserts an ActiveX control into a document using the Control Toolbox in an MS Office program. You can delete this cache file to see if it can fix the Compile error in the hidden module error.

Step 1. Press Windows + R keys at the same time. Type %appdata% in the run box.

Step 2. It will open your AppData folder. Go to Roaming > Microsoft > Forms.

Step 3. Find the .exd files, select comctllib.exd and mscomctllib.exd, and delete these two files.

Step 4. Restart your Excel and check if the problem is solved.

Method 3. Move PDF Maker Files

As we have mentioned above, one of the reasons you will see this error message is because there are two template files on Adobe Acrobat PDF Maker add-in. So in this method, you can move the PDF Maker files to another place to fix your problem. Here are the detailed steps.

Step 1. Open Windows File Explorer, search pdfmaker.* on your computer.

Step 2. Choose the pdfmaker.dot and pdfmaker.xla files, right-click on both files, and select cut.

Step 3. Paste these two files to your Desktop.

Now you can restart the MS Excel to see if the problem is solved.

Method 4. Update to the Latest Adobe Acrobat

If the above methods can’t help you solve the Compile error in hidden module problem, the last resort is to update the Adobe Acrobat to the latest version. It’s because this problem is associated with the Adobe Acrobat that is installed on your computer.

Go to the Adobe official website, find the latest version of Acrobat, download and install it on your computer.

related articles

How to Fix Word Runtime Error 91?

A runtime error is a common program error that usually occurs in Microsoft Office software. This article will you what is the reason for this error, and how to fix it.

runtime error 91

Bonus Solution: Repair Damaged or Corrupted MS Excel Efficiently

With the above methods, you might have solved the Excel Compile error in the hidden module issue. Then we’d like to share a good bonus tool — EaseUS Data Recovery Wizard with you. 

This is an advanced 4-in-1 specialized fix tool that enables you to repair corrupted  PDF documents and Office files in multiple formats. If your documents got damaged, Stellar file repair software will scan and repair them efficiently. 

If you want to try on this file repair software, you can download it and follow the guide to see how to use this tool. In the following guide, we have introduced how to repair Excel documents.

Step 1. Launch EaseUS Data Recovery Wizard. Select a disk location where the corrupted files are saved. Click «Scan» to start finding the broken files. EaseUS file repair tool allows you to fix damaged documents, videos, and pictures in differnet formats. 

select a location and click scan

Step 2. After scanning, you can quickly find corrupt data by file type. If you want to repair damaged Word, Excel, or PDF, select Documents and filter a specific category. For pictures and videos repair, all the common types are suppored, including JPEG, PNG, BMP, MOV, MP4, GIF, and more.

check scanned corrupt files

Step 3. EaseUS file repair software will automatically fix broken files. You can preview the repaired files before recovery. Last, click «Recover» and save the recovered files to a different location to avoid data overwriting.

recover and repair corrupted files

The Bottom Line

That’s all about Compile error in hidden module error message. Hope you can fix your problem after reading this article. Once again, we’d like to introduce EaseUS file repair tool. No matter whether you need to repair Word, Excel, PPT, or PDF documents, applying this tool is a wise choice.

Ошибка компиляции в скрытом модуле: <module name>

Защищенный модуль содержит ошибку компиляции. Так как эта ошибка находится в защищенном модуле, ее нельзя отобразить.

Эта ошибка обычно возникает в случае несовместимости кода с версией или архитектурой данного приложения (например, код в документе рассчитан на 32-разрядные приложения Microsoft Office, однако предпринимается попытка его запуска в 64-разрядной версии Office).

Эта ошибка имеет следующие причину и решение:

  • Ошибка возникает при наличии ошибки компиляции в коде VBA внутри защищенного (скрытого) модуля. Эта ошибка компиляции не отображается, так как модуль является защищенным.

Если у вас есть доступ к коду VBA в документе или проекте, отмените защиту модуля, а затем запустите код еще раз для просмотра сведений об ошибке.

Если доступ к коду VBA в документе отсутствует, обратитесь к автору документа, чтобы он обновил код вскрытом модуле.

Хотите создавать решения, которые расширяют возможности Office на разнообразных платформах? Ознакомьтесь с новой моделью надстроек Office. Надстройки Office занимают меньше места по сравнению с надстройками и решениями VSTO, и вы можете создавать их, используя практически любую технологию веб-программирования, например HTML5, JavaScript, CSS3 и XML.

Поддержка и обратная связь

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

Ошибка решается, проверкой не включенных модулей в окне VB,проверьте все ли необходимые модули включены,и есть ли эти модули на самом деле на ПК,возможно модуль отмечен,но сам отсутствует у меня проблему решило,включением специфических модулей для конкретного файла с расчетами.

Решение проблемы: Откройте файл в Excel – при помощи комбинации клавиш войдите в окно Visual Basic(ALT+F11), далее выберите меню “Tools-References” и посмотрите все ли отмеченные модули есть на самом деле на компьютере и все ли модули необходимые для работы Вашего макроса включены.

Error in Excel “Compile Error in Hidden Module”
Can be happen when Excel miss some reference to library.
For fix: Open Excel – Go to VB window -(ALT+F11).Open Tools-References and check unchecked modules(only needed for your Document).

Решения для ошибки компиляции в скрытом модуле в Excel или Word [Новости MiniTool]

ошибка компиляции в скрытом модуле

При использовании Excel или Word вы можете получить сообщение об ошибке «Ошибка компиляции в скрытом модуле». Что делать, чтобы избавиться от ошибки компиляции Word или Excel на ПК с Windows? Успокойтесь, и теперь вы можете получить несколько простых методов из этого сообщения, предлагаемого MiniTool .

Ошибка компиляции Excel или Word в скрытом модуле

При запуске Excel или Word на экране вашего компьютера может появиться сообщение «Ошибка компиляции в скрытом модуле». Модуль может быть thisworkbook, hstbarpublic, menuandtoolbar, aowd и т. Д.

Почему возникает ошибка компиляции? Это связано с тем, что Microsoft обновляет Office 2016 с 32-разрядной версии до 64-разрядной версии, но в Office есть несовместимые 32-разрядные надстройки. То есть некоторые надстройки содержат код, несовместимый с текущей версией Office 2016.

Что делать, чтобы избавиться от ошибки? Решения для вас ниже.

исправить не отвечающий Excel эскизУстранение неполадок Excel и спасение ваших данных (несколькими способами)

Вы хотите избавиться от Microsoft Excel, который не отвечает? В этом посте мы покажем вам несколько методов, которые могут эффективно решить эту проблему.

Исправления ошибок компиляции в скрытом модуле Excel или Word

Обновите Adobe Acrobat

Два файла шаблона Adobe Acrobat в папке Office могут вызвать сообщение об ошибке компиляции. Одно из возможных решений — обновить Adobe Acrobat.

Шаг 1. Щелкните это приложение, перейдите в Справка> Проверить обновления .

Шаг 2. Если есть обновления, нажмите Загрузить и установить .

Используйте CMD для регистрации файлов OCX

Чтобы исправить ошибку компиляции Excel, вам необходимо зарегистрировать некоторые файлы, необходимые для работы Excel. Просто следуйте этим инструкциям:

Шаг 1. Запустите командную строку (CMD) с правами администратора.

Шаг 2: Введите следующие команды и нажмите Войти после каждого:

В 32-битной Windows:

regsvr32 -u c: windows system32 mscomctl.ocx

regsvr32 c: windows system32 mscomctl.ocx

В 64-битной Windows:

regsvr32 -u c: windows syswow64 mscomctl.ocx

regsvr32 c: windows syswow64 mscomctl.ocx

Зарегистрируйте файлы OCX

Шаг 3: Запустите Excel и посмотрите, исправили ли вы ошибку компиляции в скрытом модуле.

Переместить файлы Pdfmaker в другую папку

Pdfmaker.xla и pdfmaker.dot — это два файла Adobe Acrobat, вызывающие ошибку компиляции. Итак, вы можете переместить эти файлы из папок MS Office, чтобы исправить проблему.

Шаг 1: введите pdfmaker.xla в поле поиска и щелкните его правой кнопкой мыши, чтобы выбрать Откройте расположение файла .

Шаг 2: В проводнике скопируйте и вставьте этот файл в другую папку, например на рабочий стол.

Шаг 3. Сделайте то же самое с файлом pdfmaker.dot.

Теперь вам нужно избавиться от ошибки компиляции в скрытом модуле.

Удалить файлы .exd

Если описанные выше решения не помогли, попробуйте удалить файлы .exd со своего компьютера. Это может быть полезно для исправления ошибки компиляции Excel или Word в скрытом модуле.

Шаг 1: нажмите Win + R , ввод %данные приложения% и нажмите Хорошо .

Шаг 2: нажмите Microsoft> Формы .

Шаг 3. Щелкните правой кнопкой мыши comctllib.exd и mscomctllib.exd и щелкните удалять чтобы удалить их по одному.

Обновите антивирус Norton

Norton Antivirus может быть связан с ошибкой компиляции в скрытом модуле. Если на вашем настольном компьютере или ноутбуке установлено это программное обеспечение, его обновление может помочь решить проблему.

Шаг 1. Перейти к эта ссылка и нажмите Обновите меня сейчас .

Шаг 2: Щелкните файл .exe, чтобы запустить его и завершить обновление.

Если обновление не может решить вашу проблему, вы можете удалить это антивирусное программное обеспечение со своего компьютера и посмотреть, удаляется ли ошибка. Просто обратитесь к этому сообщению — Четыре идеальных способа: как удалить программы в Windows 10 .

Конец

Вас беспокоит ошибка компиляции в скрытом модуле при использовании Word или Excel? Не принимайте это близко к сердцу. Попробовав эти методы, вы легко и эффективно избавитесь от этой проблемы.

На чтение 4 мин. Просмотров 1.8k. Опубликовано 03.09.2019

Содержание

  1. Вот как можно исправить ошибки компиляции в Word и Excel
  2. Как исправить ошибки компиляции в Word/Excel?
  3. 1. Обновите Adobe Acrobat
  4. 2. Переместите файлы Pdfmaker в другую папку
  5. 3. Перерегистрируйте файлы OCX с помощью командной строки.
  6. 4. Обновите антивирусное программное обеспечение Norton
  7. 5. Удалите программное обеспечение Norton

Вот как можно исправить ошибки компиляции в Word и Excel

  1. Обновление Adobe Acrobat
  2. Переместить файлы Pdfmaker в другую папку
  3. Повторная регистрация файлов OCX с помощью командной строки
  4. Обновите антивирусное программное обеспечение Norton
  5. Удалите программное обеспечение Norton

« Ошибка компиляции в скрытом модуле » – это сообщение об ошибке, которое может появиться у некоторых пользователей MS Word и Excel. Сообщение об ошибке появляется, когда пользователи Office открывают Word или Excel. Следовательно, ни одно приложение не запускается для пользователей. Появляется ли сообщение об ошибке « Ошибка компиляции в скрытом модуле » при открытии Excel или Word? Если это так, вот несколько решений, которые могут это исправить.

Как исправить ошибки компиляции в Word/Excel?

1. Обновите Adobe Acrobat

Ошибка « Ошибка компиляции в скрытом модуле » может быть связана с двумя файлами шаблонов Adobe Acrobat в папках MS Office. Таким образом, обновление Adobe Acrobat является одним из возможных решений этой проблемы. Чтобы вручную проверить наличие обновлений Adobe, нажмите Справка в окне Acrobat. Выберите Проверить наличие обновлений , чтобы открыть окно программы обновления. Затем вы можете нажать кнопку Загрузить и установить , если для нее есть обновления.

– СВЯЗАННО: как исправить то, что Word Online не работает или не отвечает

2. Переместите файлы Pdfmaker в другую папку

Pdfmaker.xla и Pdfmaker.dot – это два файла Adobe Acrobat, связанные с проблемой « Ошибка компиляции в скрытом модуле ». Таким образом, перемещение этих файлов из папок MS Office также может исправить ошибку. Вот как вы можете переместить эти файлы в альтернативную папку в Windows 10.

  • Нажмите кнопку Введите здесь поиск , чтобы открыть окно поиска Cortana.
  • Введите «Pdfmaker.xla» в поле поиска, чтобы найти этот файл.
  • Чтобы найти файл Pdfmaker.dot, введите название этого файла в поле поиска.
  • Затем щелкните правой кнопкой мыши файлы и выберите Открыть местоположение файла , чтобы открыть их папки в проводнике.
  • Если вы не можете найти эти файлы с помощью инструмента поиска, откройте папки MS Office Startup и Xlstart в проводнике. Папка «Автозагрузка» содержит файл Pdfmaker.dot, а каталог Xlstart – файл Pdfmaker.xla.
  • Чтобы переместить файлы Pdfmaker на рабочий стол, щелкните их правой кнопкой мыши в проводнике и выберите параметр Вырезать .
  • Щелкните правой кнопкой мыши другую папку (или рабочий стол Windows), чтобы переместить их и выберите Вставить .

3. Перерегистрируйте файлы OCX с помощью командной строки.

Ошибка « Ошибка компиляции в скрытом модуле » также может быть побочным эффектом обновлений Windows. Таким образом, регистрация файла mscomctl.ocx также может решить эту проблему. Вот как вы можете перерегистрировать этот файл OCX в командной строке.

  • Нажмите клавишу Windows + X горячую клавишу.
  • Выберите Командная строка (администратор) , чтобы открыть подсказку от имени администратора.
  • Для 32-разрядной платформы Windows введите в командной строке следующие команды:

regsvr32 -u c: windowssystem32mscomctl.ocx
regsvr32 c: windowssystem32mscomctl.ocx

  • На 64-битных платформах Windows введите эти команды:

regsvr32 -u c: windowssyswow64mscomctl.ocx
regsvr32 c: windowssyswow64mscomctl.ocx

– СВЯЗАННО: Excel не открывает файлы, вместо этого отображается белый экран? Вы можете это исправить

4. Обновите антивирусное программное обеспечение Norton

Norton Antivirus также связан с ошибкой Ошибка компиляции в скрытом модуле . Если Norton AV установлен на вашем настольном компьютере или ноутбуке, обновление этого программного обеспечения может решить проблему. Вы можете проверить наличие обновлений, нажав кнопку Обновить меня сейчас на этой веб-странице. Или щелкните правой кнопкой мыши значок Norton Antivirus на панели задач и выберите Norton LiveUpdate .

5. Удалите программное обеспечение Norton

  • Если обновление Norton Antivirus не устраняет ошибку скрытого модуля, рассмотрите возможность удаления программного обеспечения Norton. Для этого нажмите сочетание клавиш Windows + R.
  • Введите «appwiz.cpl» в «Выполнить» и нажмите кнопку ОК .

  • Выберите из списка антивирус Norton и нажмите кнопку Удалить .
  • Затем нажмите Да , чтобы удалить программное обеспечение.

Одно из этих решений для ошибки « Ошибка компиляции в скрытом модуле » может запустить Word или Excel, чтобы вы могли запустить их снова. Некоторые из более общих советов в этом посте по исправлению неиспользуемых приложений MS Office также могут пригодиться для решения проблемы со скрытыми модулями.

Return to VBA Code Examples

In this Article

  • Viewing a Hidden Module
  • Fixing a Syntax Error
  • Fixing a Missing Reference
  • Check the Excel Start up Folder
  • Using Add-ins and Macros from Other Providers

This article will demonstrate how to fix the VBA Error: Compile Error in Hidden Module.

The VBA Compile Error in Hidden Module occurs when you are using a VBA macro in Excel which is stored in a hidden module. This might be due to the fact that you are using an External Add-in, or you may have created your own program in a previous version of Excel that no longer works in your current version of Excel. As the error says the module is hidden, then the code is most likely protected by a password and not normally available for the user to Edit.

vbacompile hidden module

Viewing a Hidden Module

The first thing to do to solve the problem would be to see if you can unhide the hidden module.

Press Alt+F11 to go to the VBE Editor.

OR

In the Ribbon, select Developer > Visual Basic.

vbacompile vbe

Note: If you don’t see the Developer Ribbon, you’ll need to enable it.

You will then be able to view your hidden module and fix the error.

Fixing a Syntax Error

(1) Double-click on the VBA Project that contains the hidden module, and then, (2) type in the Password.

vbacompile password

In the Menu, select Debug > Compile to compile the project.

vbacompile debug

The compile error should immediately pop up.  In this case we have a simple syntax error in the code.

vbacompile syntax error

Fix the error, and then click Debug > Compile again.  Once the project is successfully compiled, the compile option will be greyed out.

vbacompile compiled

Save the project to keep your changes.

vbacompile save file

Fixing a Missing Reference

Another common reason for a compile error in Excel is a missing reference. First, unhide your module in the same way as shown above, and then in the Menu, select Tools > References.

vbacompile error reference

Scroll down through the list of references to find the one you want to use.  In this case, the Microsoft Word 16.0 Object Library.

vbacompileerror add reference

(1) Select the reference and then (2) click OK and then Save your File.

Check the Excel Start up Folder

You may find that you have an add-in installed that you no longer require and these may be causing issues when you try and open Excel.

Make sure Excel is closed and then, in the File Manager of your PC, go to the XLSTART folder (this is usually located in C:UsersUSERNAMEAppDataRoamingMicrosoftExcel).

Remove any Add-ins (XLA or XLAM files) that you are not using.

Restart Excel.

Using Add-ins and Macros from Other Providers

If you use macros or add-ins from an external provider, chances are you are not going to have access to the password to fix your compile error. If this is the case you would need to contact the provider of the add-in or macro in order to update it to your version of Excel. To solve the compile error problem you would need to disable the add-in.

In the Ribbon, select Developer > Add-ins, and then select either Excel Add-ins or COM Add-ins.

vbacompile select addins

Remove the check mark from any selected add-in that is causing combability issues, and then click OK.

Close and Re-Open Excel.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro — A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!
vba save as

Learn More!

You might receive a “Compile Error in Hidden Module” error message when you start your Excel.

Whether it is Excel or any other Microsoft Applications from time to time they are prone to errors. This Compile Error in Hidden module occurs in both MS Excel and MS Word but in this blog, you will get to know how to repair Compile Error in Hidden module in Excel.

When you start MS Excel the particular error message that displays on the screen is:

Compile error in hidden module: AutoExec

Compile error in hidden module: AutoExecNew

Compile error in hidden module: DistMon

If you are using an older version of Windows like Windows 95/98 then you might receive an error message that says:

Excel has performed an error in module excel.exe and will be closed.

For Windows 2000 and above version the error appears like:

Excel has encountered a problem and needs to close. We are sorry for the inconvenience.

After the error message is displayed, an error report will be presented which provide the additional information of that error, a link will be shown something like:

– 9.0.0.5302 – Vbe6.dll – 6.0.89.67 – 0000d799

Just click on the link to view full details of that error and depending on the application that has been crashed you might see the location to excel.exe which will guide you to the culprit of this error message.

To repair Compile Error in Hidden module go through the solutions one by one but before that get to know why does this Compile Error in Hidden module in Excel appears.

To recover Excel corrupt module, we recommend this tool:

This software will prevent Excel workbook data such as BI data, financial reports & other analytical information from corruption and data loss. With this software you can rebuild corrupt Excel files and restore every single visual representation & dataset to its original, intact state in 3 easy steps:

  1. Download Excel File Repair Tool rated Excellent by Softpedia, Softonic & CNET.
  2. Select the corrupt Excel file (XLS, XLSX) & click Repair to initiate the repair process.
  3. Preview the repaired files and click Save File to save the files at desired location.

Why Does Compile Error In Hidden Module In Excel Appear?

Microsoft is upgrading Office 2016 from 32-bit version to 64-bit version. This Compile Error in Hidden module error message usually appears when there are dome 32-bit add-ins versions of office which are incompatible with the newer version.

The most common reason behind this error is when some conditions come true:

1: MS Excel startup folder when contains both the template files on Adobe Acrobat PDF Maker add-in:

Pdfmaker.dot
Pdfmaker.xla

2: Software named Norton Anti-virus software has been installed.

Now, that you know the reason that causes Compile Error in Hidden module in Excel. Let’s begin with the solutions to fix this error.

1: Re-register OCX Files Using CMD

To fix compile error in hidden module you need to re-register some files basic to the functionality of Excel. Follow the steps:

  • Start your system with the Administrative rights
  • Press Windows + R key
  • Type “cmd” and click on OK

  • Depending on the version type the following commands and press enter:

For 32-bit version

regsvr32 -u c:windowssystem32mscomctl.ocx
regsvr32 c:windowssystem32mscomctl.ocx

For 64-bit version

regsvr32 -u c:windowssyswow64mscomctl.ocx
regsvr32 c:windowssyswow64mscomctl.ocx

Now, run MS Excel and see whether Microsoft visual basic compile error in hidden module is solved or not.

2: Try Deleting .exd Files

If the above-given solution did nor work then try deleting the .exd files from your folder, this might help you in fixing the compile error in the hidden module in excel. Follow the steps to delete files:

  • Press Windows + R key
  • Type %appdata% and click OK

  • This will open the Application Data folder, now select Microsoft

  • Open the Forms folder

  • Select comctllib.exd and mscomctllib.exd, Right-click on them and Delete

Deleting the .exd files will let you start Excel and the compile error in the hidden module issue will be resolved.

3: Move PDF Maker Files

If you are using Adobe Acrobat PDF Maker then to solve this issue you need to move the Pdfmaker.dot file and Pdfmaker.xla files to a different location. To do so follow the steps given below:

  • Click on the Windows icon and type pdfmaker. *

  • Click on all files and folders.

  • In the All or part of the file name type pdfmaker. * and search

  • Once the files are located, right-click on the pdfmaker.dot & pdfmaker.xla, and select the Cut.

  • Go to the Desktop and Paste it

After moving the PDF files by performing the above-stated steps compile error in the hidden module excel issue must be solved.

4: Update Latest Version of Adobe Acrobat

If the above method mentioned didn’t fix the Excel Compile error in the hidden module 2016 problem, then you can try updating the Adobe Acrobat version.

To update the add-in Adobe Acrobat, visit the official website of Adobe. You can find the newest updates in the search engine by searching the Adobe Acrobat Updates.

After updating the Adobe Acrobat restart your system and see if the compile error in hidden module Excel problem is solved or not.

5: Fix “Compile error in hidden module” Module 1

This error also occurs when you have recently upgraded or might have saved an Excel file that was created in different locations between versions.

To fix Excel compile error in hidden module  issue follows the simple steps mentioned below:

  • Select the file that is wrongly saved in Excel
  • Press AltF11 to go into the file Visual Basic Editor.
  • From the Tools menu, select the References
  • Scroll down to the Available References box and uncheck all that starts with MISSING:
  • Press AltQ when all the reference errors have been unchecked.

These steps will help you to fix the compile error in hidden module 1 issue.

Automatic Solution: MS Excel Repair Tool

If you are finding the above solutions difficult to perform and if you are unable to solve compile error in hidden module Excel issue, then you can try running MS Excel Repair Tool.

This is an advanced repairing tool that not only repairs damaged, corrupted, or inaccessible Excel files and all sorts of Excel errors but also recovers deleted, lost data from chart sheets, cell comments, formulas & others.

One can easily use this tool without the need for any professional and it supports all Excel versions.

* Free version of the product only previews recoverable data.

Steps to Utilize MS Excel Repair Tool:

Conclusion:

So, this was all about compile error in hidden module Excel. Well, I have tried my best to put together all the working solutions together to fix this issue.

Carefully follow the solutions given one by one. They are easy to use and had worked for many users.

Hope you liked this article and it worked for you in fixing the compile error in hidden module excel issue and making your Excel work again without any error.

Apart from this if you have any suggestions or queries then feel free to share them with us in the below comment section.

Summary

How to Fix Compile Error in Hidden Module Excel?

Article Name

How to Fix Compile Error in Hidden Module Excel?

Description

Learn to troubleshoot ‘compile error in hidden module’ error message when using Excel with the step by step solutions and make Excel error-free.

Author

Publisher Name

Repair MS Excel Blog

Publisher Logo

Repair MS Excel Blog

Priyanka Sahu

Priyanka is an entrepreneur & content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.

Понравилась статья? Поделить с друзьями:
  • What is common word in the english language
  • What is column width in excel
  • What is column number in excel
  • What is column letter in excel
  • What is column index in excel