Cannot Access Methods or Properties for Microsoft Office ActiveX References

Updated Jun 16, 2020

Reported In

Software

  • LabVIEW
  • LabVIEW Report Generation Toolkit

Other

  • Microsoft Office
  • Microsoft Word
  • Microsoft Excel

Issue Details

  1. I am using the LabVIEW Report Generation Toolkit to generate Microsoft Word or Microsoft Excel reports. I have custom formatting that I need to apply using Property and Invoke Nodes.
  • When I try to select a class for Property or Invoke Nodes, I do not see the Microsoft Excel or Microsoft Word type libraries.
  • I am getting error -41106 word would not open when using the Create Report VI
  • When I load existing code, I cannot edit the existing nodes. Instead, my ActiveX Property and Invoke Nodes show No Properties or No Methods.
  • When I drop a property node or invoke node on the block diagram, there are no classes or methods to select. I also cannot modify property nodes within LabVIEW examples.

 
  1. I am using the LabVIEW ActiveX built in functions to manipulate Microsoft Word or Microsoft Excel documents. 
 
  • When I try to select a class for Property or Invoke Nodes, I do not see the Microsoft Excel or Microsoft Word type libraries.
  • When I try to access properties or methods from Property and Invoke Nodes in my code, my ActiveX Property and Invoke Nodes show No Properties or No Methods.
  • When I load existing code, I cannot edit the existing nodes. Instead, my ActiveX Property and Invoke Nodes show No Properties or No Methods.
How can I access these properties and methods? 

Solution

  • When using the LabVIEW Report Generation Toolkit:
This behavior can happen if you use LabVIEW 32-bit and Microsoft Office 64-bit. For example, Excel 2016 64-bit will not work with LabVIEW 2018 32-bit. To solve this issue, use LabVIEW 32-bit with Microsoft Office 32-bit , or, LabVIEW 64-bit with Microsoft Office 64-bit.
 
  • When using the LabVIEW ActiveX built in functions:
This behavior happens because LabVIEW is not linked to the needed Microsoft Object Library. In order to do so, follow the next steps:
Note: these steps are for a Microsoft Word document. For Microsoft Excel the steps are analogous. 
  1. Right-click the Word._Application reference to display its options.
  2. Go to the Select ActiveX Class option, then, click the Browse… option.
  3. Once the Select Object From Type Library window is displayed, click again on Browse…
  4. Now, you must follow the path where the Microsoft Windows Library is located. Its name is MSWORD.OLB and the default path is: C:\Program Files\Microsoft Office\root\Office16\MSWORD.OLB.
  5. Once you load it, you will be able to select the _Application option.
  6. You might need to click OK and follow steps 1 and 2 again so LabVIEW can load the options from the library. 

Additional Information

Refer to About Office: What version of Office am I using? for steps to check the bitness of your Microsoft Office installation.

While it seems possible to use LabVIEW 64-bit with Microsoft Office 32-bit, it is recommended to have matching bitness between LabVIEW and Microsoft Office.