Excel báo lỗi compile error in hidden module regapi

enter image description here I have a problem about excel VBA. Excel file is created for many years. It run VBA code in 32 bit excel. However, my computer upgrade 32 bit excel to 64 bit excel. I cannot run the VBA file anymore.

It show the error: Compile error in hidden module. This error commonly occurs when code is incompatible with version, platform or architecture of this application.

Is that any solution. Thanks.

asked Dec 17, 2020 at 6:08

AlexMoshiAlexMoshi

2191 gold badge3 silver badges11 bronze badges

3

I have resolved same error by following these 4 steps :

  1. Open Excel file which is having issue, press Alt + F11 go into its Visual Basic Editor.
  2. From the Tools menu select References [ Note, if references option is disabled in tools menu try closing and reopening file and enable Macro before proceeding next steps]
  3. Scroll through the available References List and uncheck any item start with MISSING:
  4. Press Alt + Q once all of these reference errors have been unticked.

If above steps does not solve issue try editing registry entries for 32/64 bit versions excel application.

This link has mentioned all troubleshooting steps //www.repairmsexcel.com/blog/fix-compile-error-in-hidden-module-excel

Thanks

answered Apr 21, 2021 at 12:43

You can try to check if any missing variable declaration. I had same issue and found out that missing declaration for one variable using for looping

answered Sep 22, 2021 at 3:19

1

I had this issue with the first-party Solver addin that is included with Excel. The solution was to use Windows 8 compatibility mode.

Original source

answered Oct 28, 2021 at 4:04

AndrewAndrew

1711 silver badge7 bronze badges

In my case I had locked the project containing the macros I wrote. I was getting this error when I ran the bad macro without unlocking the project. When I unlocked and ran the macro, I would have detected the error and fixed it. Problem solved.

  1. Open Visual Basic Editor
  2. Run the same macro [that got this error]
  3. Fix VBA errors
  4. Save Project
  5. Run the same macro

JohnM

3,0513 gold badges11 silver badges24 bronze badges

answered Aug 29 at 10:29

Tried so many methods, nothing worked. But after uninstalling and resintalling office product fixed the issue. Its due to crashing of document cache.

Khi mở 1 file excel có VBA, có thể bạn gặp phải thông báo lỗi compile error in hidden module. Vậy lỗi này do đâu mà có? Cách sửa lỗi này như thế nào? Hãy cùng Học Excel Online tìm hiểu qua bài viết này nhé.

Xem nhanh

Khi nào thì xảy ra lỗi compile error in hidden module?

Lỗi này thường xuất hiện với thông tin như sau:

Compile error in hidden module: ‘tên module‘. This error commonly occures when code is incompatible with the vesion, platform, or architecture of this application. Click “Help” for information on how to correct this error.

Nguyên nhân chủ yếu của lỗi này là do khi chúng ta đặt mật khẩu trong VBA, bất kỳ lỗi nào phát sinh trong VBA để xuất hiện dưới dạng thông báo lỗi compile error in hidden module.

Bởi vì khi đó VBA sẽ không xác định được cụ thể bên trong câu lệnh VBA của bạn có nội dung gì, lỗi chính xác ở vị trí nào. Do đó VBA chỉ báo lỗi chung chung như vậy.

Còn khi bạn không đặt mật khẩu trong VBA, bạn chỉ thấy xuất hiện lỗi dạng cho phép Debug, ví dụ như sau:

Khi bấm vào nút Debug, chúng ta sẽ đi tới chính xác vị trí lỗi trong cửa sổ VBA để có thể xem lại lỗi đó.

Cách khắc phục lỗi compile error in hidden module trong Excel VBA

Bởi nguyên nhân trên, chúng ta khắc phục lỗi này bằng cách: Hạn chế đặt mật khẩu trong VBA.

  • Chỉ đặt mật khẩu khi các lệnh VBA đã hoạt động chính xác, không có bất kỳ lỗi nào.
  • Nhớ mật khẩu đã đặt trong VBA để có thể mở ra khi gặp lỗi này; hoặc liên hệ với tác giả của file Excel chứa VBA để báo lỗi.

Khi bạn mở chế độ khóa bằng mật khẩu, VBA sẽ thay đổi cách báo lỗi khác, giúp bạn xác định được cụ thể lỗi ở đâu.

Khi bạn mới học VBA, bạn không nên khóa mã VBA bằng mật khẩu, bởi bạn khó lòng chắc chắn sẽ không có lỗi gì trong các lệnh VBA của mình. Ngoài ra người khác cũng khó giúp đỡ bạn được khi không biết chính xác lỗi xảy ra ở đâu.

Chủ Đề