Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154
In VS – project properties – in the Build tab – platform target =X86
In VS – project properties – in the Build tab – platform target =X86
Excel does not quit because your application is still holding references to COM objects. I guess you’re invoking at least one member of a COM object without assigning it to a variable. For me it was the excelApp.Worksheets object which I directly used without assigning it to a variable: Worksheet sheet = excelApp.Worksheets.Open(…); … Marshal.ReleaseComObject(sheet); … Read more