
The instructions for this depend on which version of Windows you're using: Windows 10
Follow through the instructions until your version of Office has been updated with all the latests patches and service packs (e.g. Visit the Microsoft Update page for instructions on how to run Windows update on your particular machine (typically via "Windows Update" in the Windows Control Panel). Make sure that Excel is closed (ideally you will have rebooted your computer so that Excel hasn't even been opened yet in your current Windows session). This should be the same process as updating Windows, as Microsoft has merged the two: It's best to reboot your computer before starting an update or repair, to reduce the chances of a running program preventing files from being repaired or replaced. Updating and repairing Excel will often fix things.įollow the steps below – first update, then repair. Note: My system is Windows 8.1 with PowerShell v5 and Office 2013.If an Excel add-in is acting peculiarly (or not at all), it's often because Excel is broken in some way. Then because that only seemed to work like 90% of the time, I added the garbage collection command at the end and finally had a solution that seems to work every time without having to kill the process. first and then I do the worksheet, workbook, and finally the Excel application itself.
In my code I release all the ones like ranges, tables, etc. If you were to take out just one of the ReleaseComObject statements, the Excel process would remain open. I got closer when I started releasing all of the COM objects I saved as variables, not just the ones for the workbook, worksheet, and Excel application.įor example, take the following example code: $Excel = New-Object -ComObject Excel.Application I ran into the same problem and tried various solutions without success.