What triggers OLE_E_INVALIDRECT?
You're working in an Office app—Word, Excel, or Outlook—and you try to drag a shape or paste a chart. Or maybe you're using a third-party tool that interacts with OLE (Object Linking and Embedding), like a screenshot app or a file manager that supports drag-and-drop. Suddenly, you get the error: OLE_E_INVALIDRECT (0x8004000D). The official message: "Invalid rectangle." But what does that actually mean?
OLE uses rectangles to define where objects sit on screen or in a document. When the rectangle coordinates are out of bounds—negative values, zero width/height, or just garbage—OLE throws this error. The fix depends on what's causing the bad rectangle. I've seen this most often with high-DPI monitors (125% or 150% scaling) and broken registry keys from old installs.
Quick fix (30 seconds): Change DPI scaling per app
This is the first thing I try. I'd say 70% of the time, the issue is Windows scaling. Modern monitors with 125% or 150% scaling can confuse older OLE components.
- Right-click the shortcut for the app that shows the error (like Word or Excel).
- Choose Properties.
- Go to the Compatibility tab.
- Click Change high DPI settings.
- Check the box: Override high DPI scaling behavior.
- In the dropdown below it, select Application (not System or System Enhanced).
- Click OK on both windows.
- Restart the app.
What you should see: After you restart, try the drag or paste action again. If the error's gone, you're done. If not, move on.
Why this works: Setting scaling to "Application" tells Windows to let the app handle its own scaling. The app then generates rectangle coordinates that it understands, not the scaled-up ones Windows would normally produce.
Moderate fix (5 minutes): Repair or re-register OLE DLLs
If the quick fix didn't work, OLE's own files might be corrupted or misregistered. This happens after a bad update or when uninstalling a program that messed with COM components.
- Open an administrator Command Prompt. Hit the Start key, type
cmd, right-click Command Prompt, choose Run as administrator. - Type these commands one at a time, hitting Enter after each:
regsvr32 /u ole32.dll
regsvr32 ole32.dll
regsvr32 /u oleaut32.dll
regsvr32 oleaut32.dll
regsvr32 /u oleacc.dll
regsvr32 oleacc.dll
What you should see: Each regsvr32 call should return a success message like "DllRegisterServer in ole32.dll succeeded." If you get any error, note it—it points to a deeper problem (like missing system files).
- After all six commands run, restart your computer.
- Test the action that gave the error.
Still failing? Move to the advanced fix.
Advanced fix (15+ minutes): Registry tweak for COM/OLE rectangle size
This one is for when DPI and DLL re-registration didn't cut it. I've seen a specific registry key in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced that can cause OLE to freak out if set wrong. The key is UseDesktopIconSizeForOLE. It's not there by default, but third-party tools (like display scaling utilities) sometimes leave it behind.
Warning: Editing the registry can break things. Back up your registry first (File > Export in Registry Editor).
- Press Win + R, type
regedit, hit Enter. - Navigate to:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
- Look in the right pane for UseDesktopIconSizeForOLE. It's a DWORD (32-bit) value.
- If it exists, delete it (right-click > Delete).
- If it doesn't exist, create it: right-click empty space > New > DWORD (32-bit) Value, name it
UseDesktopIconSizeForOLE, and set its value to 0. - Close Registry Editor.
- Restart your computer.
What you should see: After the restart, the OLE_E_INVALIDRECT error should be gone. If not, there's a chance the key also needs to be set in HKEY_LOCAL_MACHINE under the same path. Check there too and repeat steps 3-6.
Why this works: The UseDesktopIconSizeForOLE key overrides how OLE calculates rectangle sizes—it uses desktop icon dimensions instead of the default. When those dimensions are weird (like negative or zero from a bad app), you get the invalid rectangle error. Setting it to 0 or deleting it forces OLE back to its default calculation.
When none of these fix it
If you're still stuck after all three steps, it's likely a deeper system file corruption. Run sfc /scannow in an admin Command Prompt. If SFC finds corrupt files it can't fix, run DISM /Online /Cleanup-Image /RestoreHealth. That uses Windows Update to replace corrupted system files.
Also check if the error only happens with one specific file. A corrupt OLE object inside a Word doc or Excel sheet can throw this error even if the system is clean. Try the same action on a new blank file—if it works there, the problem is in that one file.