Remove an Embedded OLE Object That Freezes Excel with VBA
Question details
The user needs to remove an embedded email or OLE object that makes Excel stop responding or prevents the workbook from closing.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- An accidentally embedded object is freezing the active worksheet, and the user needs to delete it safely with VBA.
- Observed behavior
- Excel may stop responding or remain unable to close while the embedded OLE object is present.
Save a backup copy of the workbook before editing it. Confirm which worksheet contains the embedded object and, if possible, note its position or order among the sheet's shapes.
Delete the embedded OLE object with an Excel VBA macro
Use this method when the embedded object prevents normal selection or deletion and you can open the Visual Basic Editor.
The macro targets the first shape on the active worksheet and deletes it only when it exposes an OLE format. If the embedded object has a different shape index, replace Shapes(1) with the correct index before running the code.
Open the workbook in Excel, select the Developer tab, and click Visual Basic. If Developer is hidden, enable it through File > Options > Customize Ribbon.
In the Visual Basic Editor, choose Insert > Module to create a standard module, then paste this code: Sub RemoveEmbeddedObject() On Error Resume Next ActiveSheet.Shapes(1).OLEFormat.Delete End Sub
Click inside the RemoveEmbeddedObject procedure and choose Run > Run Sub/UserForm, or press F5. Make sure the worksheet containing the embedded object is active first.
Return to Excel, save the workbook, close Excel completely, and reopen the file to confirm that it responds normally.
Remove the object manually from the worksheet
Use this option when Excel remains responsive and the embedded object can be selected normally.
Open and manage Excel workbooks with a lightweight WPS Office alternative
If the freeze is caused by Microsoft Excel's OLE or VBA handling, WPS Office provides a free, lightweight alternative for opening and editing compatible spreadsheets. Its familiar interface supports a smooth transition and helps preserve common Microsoft Office workbook formats during migration.
- 1. Install WPS Office: Download and install WPS Office, then launch WPS Spreadsheets from the main application screen.
- 2. Open the workbook: Choose Open from the home screen or select File > Open, then select the compatible Excel workbook.
- 3. Inspect the worksheet object: Select the affected worksheet and use the spreadsheet editing tools to locate, select, or remove the embedded object if it is supported in the imported file.
- 4. Save a compatible copy: Choose File > Save As and select an Excel-compatible .xlsx or .xls format when saving the edited workbook.

Frequently Asked Questions
Why can an embedded email or OLE object make Excel freeze?
An OLE object can trigger an external application, damaged link, or unresponsive embedded-file handler. Excel may then stop responding or fail to close until the object is removed.
Does the VBA macro delete every object on the worksheet?
No. The macro targets only ActiveSheet.Shapes(1).OLEFormat. It assumes the first shape is the embedded OLE object and does not intentionally delete other shapes.
What should I do if Shapes(1) is not the frozen object?
Change the shape index in the macro, such as ActiveSheet.Shapes(2), after identifying the correct object. You can also use Home > Find & Select > Selection Pane when Excel remains responsive.
Can I run this macro if Excel will not open the workbook normally?
Try opening Excel in Safe Mode or opening the workbook without enabling content, then use the Visual Basic Editor if the file becomes accessible. If Excel remains completely unresponsive, work from a backup copy or use another compatible spreadsheet application to recover the workbook.




