DISP_E_DIVBYZERO (0X80020012) — Real Fixes That Work
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:
- Open the VBA editor (Alt+F11 in Office).
- Go to
Debug > Compile VBAProject. If it fails, it'll highlight the offending line. - Find the division line — usually something like
result = a / bwherebis 0. - Add error handling. Wrap it in an
On Error GoToblock or check for zero before dividing:
If b <> 0 Then
result = a / b
Else
result = 0 ' or handle gracefully
End IfIf 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:
- Go to
File > Options > Add-ins. - At the bottom, set the dropdown to
COM Add-insand click Go. - Uncheck all add-ins. Apply. Restart the app.
- 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:
- Open Control Panel > Programs and Features.
- Find your Office version (e.g., Microsoft 365, Office 2021).
- Right-click it and choose Change.
- Select Quick Repair first — it's fast and fixes about 70% of these cases.
- 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
| Symptom | Most Likely Fix | Time to Test |
|---|---|---|
| Error on opening a specific file | Fix the VBA macro in that file | 5 minutes |
| Error on any file or action | Disable COM add-ins | 10 minutes |
| Error in non-Office apps | Quick Repair Office | 15 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?