Error 1045 When Using Report Generation Toolkit for Microsoft Office

Updated Nov 4, 2019

Reported In

Software

  • LabVIEW
  • LabVIEW Report Generation Toolkit

Issue Details

I was running the Easy Text Report VI or another VI in the Report Generation Toolkit, and I received the following error:

Unknown System Error in Word_Create_Document.vi->New Report.vi->Easy Text Report.vi Error is 1045 Error 1045 occurred at Unknown System Error in Word_Create_Document.vi->New Report.vi->Easy Text Report.vi.

Possible reasons:
LabVIEW: Null Refnum passed to Close Reference


What can I do to resolve this error?

Solution

This Unknown System Error is actually a Microsoft ActiveX error. It means that the ActiveX control may not be properly registered. To check if the control is registered properly, we will need to use the registry editor. To run the registry editor, go to Start Run, type regedit in the text entry field, and select OK.

NOTE: Editing the Registry can damage your computer. Making a backup copy before modifying the Registry is strongly encouraged. To do this go to the Registry Menu and choose Export Registry File. Select All for the export range, and select a file name.

Once the registry editor is open, navigate to the following key for Microsoft Excel:
HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}

This key contains the location of the type libraries for Excel. Under this key, make sure that the following subkeys have the correct data associated with them.
  • The data for the 1.0 subkey should be Microsoft Excel 5.0 Object Library
  • The data for the 1.2 subkey should be Microsoft Excel 8.0 Object Library
  • The data for the 1.3 subkey should be Microsoft Excel 9.0 Object Library
  • The data for the 1.4 subkey should be Microsoft Excel 10.0 Object Library
  • The data for the 1.5 subkey should be Microsoft Excel 11.0 Object Library
  • The data for the 1.6 subkey should be Microsoft Excel 12.0 Object Library (MS Excel 2007)
  • The data for the 1.7 subkey should be Microsoft Excel 14.0 Object Library (MS Excel 2010)
  • The data for the 1.8 subkey should be Microsoft Excel 15.0 Object Library (MS Excel 2013)
  • The data for the 1.9 subkey should be Microsoft Excel 16.0 Object Library (MS Excel 2016)
The key for Microsoft Word is the next in the list:
HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}

Again, make sure that the following subkeys have the correct data:
  • The data for the 8.0 subkey should be Microsoft Word 8.0 Object Library
  • The data for the 8.1 subkey should be Microsoft Word 9.0 Object Library
  • The data for the 8.2 subkey should be Microsoft Word 10.0 Object Library
  • The data for the 8.3 subkey should be Microsoft Word 11.0 Object Library
  • The data for the 8.4 subkey should be Microsoft Word 12.0 Object Library
  • The data for the 8.5 subkey should be Micosoft Word 14.0 Object Library (MS Word 2010)
  • The data for the 8.6 subkey should be Micosoft Word 15.0 Object Library (MS Word 2013)
  • The data for the 8.7 subkey should be Micosoft Word 16.0 Object Library (MS Word 2016)
Depending on the version of Microsoft Office that has been installed on your system you may not have all the subkeys listed above, but you need to make sure that the existing subkeys have correct values. If the data for one of the subkey is missing, you can enter it by double-clicking the key's icon on the right side of the editor.

After making sure that the Excel and Word keys have their proper values, exit regedit and reboot the machine. Once restarted, try running the Easy Text Report VI again and the error should be gone.