2 min

A compiler bug in 64-bit Visual Basic for Applications on Windows has been present for years, according to a complaint by a user, and is responsible for preventing migration to 64-bit Office. The problem was reported by a StackOverflow user and is found in code that runs correctly in 32-bit VBA but not in the 64-bit iteration.

There are reasons why the VBA code may need to change before it can run in 64-bit mode, including Declare statements that call the Windows API.

However, this is not one of those.

The bug’s effect

It would appear that if a class is declared including a Class_Terminate() method (the destructor you call when the class is destroyed) some of the functions that should return false will instead return true.

The Register tried it and confirmed that even though the code worked as expected in 32-bit VBA, it does not do the same in 64-bit.

The publication notes that what it used for testing was a simplified example to demonstrate how the bug manifests. It was distilled from an application that worked in 32-bit VBA but broke down in 64-bit.

An old problem with no solution

The user who complained said that the bug prevents migration to Office 64 because users are unable to get their code out.

A function that returns true when it should say false could lead to problems. In a low-level disaster, the worst you could face is a crash. However, if you get the shortest end of the stick, you could get wrong results that are not noticeably wrong.

The bug was reported to Microsoft years ago, while this recent user reported it in 2018. It has been around for a while, it seems. However, it does not affect VBA on Mac. Hopefully, Microsoft does something about it.