Tuesday, October 13, 2015

Resolving or fixings compiler error in VBA

Hello Friends,
Most of the times we face compiler error even we have written all the code correctly.

Cause:

When we get "Compiler Error in hidden module" error that means Your excel project is missing one or more reference libraries or its not properly registered. 

Identify:
When you get such error goto VBA Editor window and check all libraries under Tool->Library and you wil find word missing before library name which is causing an error.

Fix:

If library is missing:

For temporary fix you can select lower version of library.

 For example if your project is showing Microsoft Active Data Object 6.1 library as missing then you can select Microsoft Active Data Object 2.0 which is a lower version. 

Or you can try permanent solution: Download that library and store on users machine and register it using below command

Open command prompt and type

Regsv32 "complete path of library"

If library is available on user machine and still showing as missing:

Then first unload library using below command and then register it.

Regsv32 /u "complete path of library"

How to avoid this error:

Write your library dependant object code in late binding form

Learn excel VBA online from an industry experience developer to strengthen your knowledge go for a structured VBA course. 

No comments:

Post a Comment