Fix the Hidden Module Utility Compile Error After Changing Office Versions
Question details
Resolve a VBA compile error in the hidden Utility module after changing Microsoft Office versions and architectures.

- Product
- Microsoft Office 2010 and Office 2016
- Device & OS
- not provided
- Scenario
- The user switched from Office 2016 32-bit to Office 2010 64-bit, then installed Office 2010 32-bit after the error appeared.
- Observed behavior
- The message “Compile error in hidden module: Utility” appeared in Office 2010 64-bit and continued after switching to Office 2010 32-bit.
Note which Office application and document or add-in trigger the error. In an Office app, check File > Account > About to confirm the installed version and whether it is 32-bit or 64-bit.
Remove Remaining Office Installations and Reinstall One Version
Use a clean single-version installation to rule out leftover or conflicting Office components.
Open Windows Settings > Apps > Installed apps, or Control Panel > Programs and Features, and look for Microsoft Office installations.
Select each Office installation and choose Uninstall. If removal fails or components remain, use Microsoft's Office uninstall tool if it supports the installed version, following its instructions.
Restart Windows, then use your Office installation media or Microsoft account to install and activate the one Office version and architecture you need.
Open the Office application and the document or add-in that produced the Utility error. If the error remains, inspect its VBA project and references.

Check VBA References and 64-Bit Declarations
Use this approach when the error persists or the affected document or add-in contains VBA code.
Identify an Add-in That Triggers the Utility Error
Use this check if the error appears when an Office application starts or when an add-in loads.
Work with Office Documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Office documents. Its format support makes it easier to move everyday files, although it does not repair Microsoft Office or guarantee compatibility with VBA macros and add-ins.

Frequently Asked Questions
Why does the Utility compile error remain after switching back to 32-bit Office?
A missing VBA reference, incompatible code, an add-in, or remaining Office components may still cause it. Check Tools > References in the VBA editor and test the affected add-ins.
How do I check whether Office is 32-bit or 64-bit?
In an Office application, open File > Account > About and look for the architecture beside the version information. The exact menu wording can vary by Office version.
What if the Utility module is hidden or password-protected?
Contact the document or add-in developer for debugging access or a compatible update. A locked project may prevent you from inspecting and compiling its code.
Does PtrSafe alone make a VBA declaration compatible with 64-bit Office?
No. In the VBA editor, review the declaration's parameter and return types as well. Pointers and handles generally need LongPtr, while other values must retain the types required by the API.




