If you get the following error:


System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

   at APS.DMS.Letters.PatientLetter.CreateLetter(String& filePath, String letterCode, Boolean isReviewLetter, DateTime dateTime, Patient patient, Provider provider, Referrer referrer, PatientAppointment appt, Consultation consult, Form parentForm)



The problem is that Microsoft Office is not installed correctly. This can happen where you have installed a newer version over the top and it hasn't properly "cleaned up" the old Office.


The fix is:

 

1. Run the Microsoft Office Removal Tool:

https://aka.ms/diag_officeuninstall

Uninstall *all* versions.

 

2. Do a Reboot.

 

3. Re-install Office.


4. Set Office folder on the Path Environment Variable to ensure WINWORD.EXE can run.

Start -> Run ->  sysdm.cpl

Advanced -> Environment Variables -> System variables -> Path -> Edit

New: c:\Program Files\Microsoft Office\root\Office16


(Note: at some point Microsoft may change to Office17 so change accordingly.)