0

I have an legacy Excel project that automates Excel 2007 on our server in order to produce overnight user-authored reports. It has worked fine but recently on trying to upgrade to Office 365 (also tried 2016) I came across a problem where it appears to throw COMException 0x800AC472 after creating the Excel.Application object.

I can create the object without error but as soon as I try to call any methods of the Application object it faults.

This is a brand new vanilla server with .Net 4.6 and 3.5 installed and Office 365, nothing else.

The code has been re-linked using COM to reference Office 15.0 Interop. And the same code still works perfectly on the old 2007 server.

Microsoft.Office.Core 16.0
Microsoft.Office.Interop.Excel 16.0 

The Error message in full:

System.Runtime.InteropServices.COMException (0x800AC472): Exception from HRESULT: 0x800AC472
   at Microsoft.Office.Interop.Excel.ApplicationClass.set_DisplayAlerts(Boolean RHS)
   at ExcelReportingService.ExcelJob.ProcessExcelBook(String location, String savePath, String testEmailsOnlyTo, Boolean allowEmptyResultFile, StringBuilder& processResults) in W:\\Group\\VIP\\Services\\ExcelReporting\\Classes\\ExcelJob.cs:line 136

The code has never had an install package and I'm not sure if this is this is the issue? Currently I am just copying the DLLs for the app to the service folder and installing with "sc create". I have not installed any other runtimes or copied any DLLs into the GAC? But I don't do this with the working 2007 server either?

Am I missing a runtime I need to install on the server?

PS: I do recognize the reality that Microsoft has said that server automation is not supported for Office, but this is a legacy project that I need to get working as all servers are being upgraded and Office 2007 will not install on newer servers.

halfer
  • 19,824
  • 17
  • 99
  • 186
DaveC
  • 63
  • 1
  • 8
  • It may be better to keep a legacy server in your data centre so you can run this on a version of Office you know is working. Your alternative is to rush to get it running on a new version of Office, but you have a problem - even if you fix it so you don't get an error, a more subtle bug might occur down the line, because the software has not been tested in the new environment. – halfer May 14 '20 at 10:25
  • Unfortunately the users that are submitting Excel reports are using Office 365 and using features that are 'newer' requiring the report to be saved as '.xlsx'. Whilst my code can handle this Excel can't load it because Office 2007 doesn't recognize .xlsx. Saving as .xls breaks the new functionality. What i don't get is that on my Dev machine where i have office 2013 and Office 365 co-existing, everything works just fine. Looks like some sort of PIA files are missing but i'm not sure - everything seems to be there! – DaveC May 14 '20 at 13:51
  • I don't have any experience in this area. I am commenting because it feels like one part of the business/enterprise is rushing forward to embrace new technology without someone having done an assessment of the impact. The knock-on effect is that a system is upgraded without the necessary testing, or a system becomes unavailable because of the mismatch between the version of Office people use and the version of Office the system needs. – halfer May 14 '20 at 13:57
  • You could try some random things. Downgrade/upgrade the version of .Net. Run the code inside Docker or a VM, to ensure the environment is clean. Check the Windows logs to see if there is any more detail in there. See if you have any support contract with a MS reseller to see if they can look into the error. – halfer May 14 '20 at 13:58
  • 1
    @halfer you are of course correct. thanks for the insight. – DaveC May 21 '20 at 08:05

0 Answers0