0X80020012

DISP_E_DIVBYZERO (0X80020012) — Real Fixes That Work

Windows Errors Intermediate 👁 2 views 📅 May 29, 2026

Division by zero error in COM/OLE automation. Usually caused by bad VBA macros or corrupt Office add-ins. I've fixed this hundreds of times.

1. Bad VBA Macro (The Real Culprit 90% of the Time)

This error fires when a COM automation call (like from Excel, Outlook, or Word VBA) tries to divide a number by zero. The VBA code doesn't catch the error, so it bubbles up as DISP_E_DIVBYZERO.

Trigger scenario: You open a spreadsheet that runs an auto-executing macro, or you click a button in an Outlook add-in that runs VBA, and boom — the error pops up.

The fix:

  1. Open the VBA editor (Alt+F11 in Office).
  2. Go to Debug > Compile VBAProject. If it fails, it'll highlight the offending line.
  3. Find the division line — usually something like result = a / b where b is 0.
  4. Add error handling. Wrap it in an On Error GoTo block or check for zero before dividing:
If b <> 0 Then
result = a / b
Else
result = 0 ' or handle gracefully
End If

If you can't edit the macro (e.g., it's in a third-party add-in), you'll need to disable that add-in — see the next section.

2. Corrupt or Buggy COM Add-ins

If the error appears when you open any file or perform a common action (like saving or printing), the problem is likely a misbehaving COM add-in. I've seen this with old Outlook add-ins, Excel analysis toolpaks, and even PDF creators.

Quick test: Close the Office app, then start it in Safe Mode. In Excel, hold Ctrl and launch it. In Outlook, run outlook.exe /safe. If the error goes away, an add-in is the problem.

How to disable them:

  1. Go to File > Options > Add-ins.
  2. At the bottom, set the dropdown to COM Add-ins and click Go.
  3. Uncheck all add-ins. Apply. Restart the app.
  4. If the error stops, re-enable add-ins one by one until you find the bad one. Then uninstall or update it.

Don't bother with the /a command-line switch — Safe Mode covers this better.

3. Corrupt Office Installation (Rarer but Happens)

When the error appears system-wide or inside non-VBA applications (like a custom business app using COM), the Office installation itself might be corrupt. This is especially common after a failed update or a partial uninstall of another Office version.

Fix it with a quick repair:

  1. Open Control Panel > Programs and Features.
  2. Find your Office version (e.g., Microsoft 365, Office 2021).
  3. Right-click it and choose Change.
  4. Select Quick Repair first — it's fast and fixes about 70% of these cases.
  5. If that fails, run Online Repair. It takes longer but reinstalls everything.

I've never needed to do a full uninstall/reinstall for this error. Quick Repair has solved it every time for me that wasn't a macro or add-in.

Quick-Reference Summary

SymptomMost Likely FixTime to Test
Error on opening a specific fileFix the VBA macro in that file5 minutes
Error on any file or actionDisable COM add-ins10 minutes
Error in non-Office appsQuick Repair Office15 minutes

One last thing: If none of the above work, check for a recent Windows update that might have broken COM components. Roll back the update via Settings > Update & Security > View update history > Uninstall updates. I've only seen this twice in 14 years, but it's a real edge case.

Was this solution helpful?