Cannot Access Methods or Properties for Microsoft Office ActiveX References

Updated Oct 28, 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 or there is a difference in bitness between Microsoft Office and LabVIEW. In order to do so, follow the next steps:
  1. Right-click the Word._Application or Excel._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. Follow the path where the Object Library is located, for both Word and Excel the default path is C:\Program Files\Microsoft Office\root\OfficeXX\, where XX is the version number
  • For Word: Its name is MSWORD.OLB.
  • For Excel: It will be necessary to change the File Type selector to All Files (*.*) to be able to see the intended executable, its name is EXCEL.EXE.
  1. Once you load it, you will be able to select the Application (Word.Application.XX) or Application (Excel.Application.XX) option, where XX is the version number.

 
  1. 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 External Link: 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.