LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX writing to Word ActiveXControl - Textbox

Solved!
Go to solution

Does anybody know, if it is possible to write from LabVIEW via ActiveX or the ReportGenerationToolkit to a Word - Control - Textbox. 

I have attached a Screenshot from the Wordfile and the Word - Testdocument.

 

I can't find any Solution until now. I can't adress such a Textbox with a simple bookmark. It seems that this object type is a Microsoft Forms 2.0-textfield.

 

I assume, that I need to load Microsoft Forms 2.0 Object Library Version 2.0 for this Object Type.

Steiner_Wolfgang_0-1634897139453.png

 

But I have no idea how I can send some text from LabVIEW to such a TextBox, because I also have to open the document which I do with word_Application Reference.

 

It would be very helpful if anyone has an idea or a example - solution how it would work.

Thanks very much!

 

 

 

  

 

 

0 Kudos
Message 1 of 4
(1,370 Views)

I'd look into the  SendKeys.SendWait  function of the System.Windows.Forms namespace. Look into that.

0 Kudos
Message 2 of 4
(1,330 Views)

Yes. This is an annoying thing. Here's the issue:

 

Cannot Access Methods or Properties for Microsoft Office ActiveX References - National Instruments (...

 

Solution, browse for:

<Excel> --> C:\Program files\Microsoft Office\root\officeXX\EXCEL.EXE

<Word> --> C:\Program files\Microsoft Office\root\officeXX\MSWORD.OLD

0 Kudos
Message 3 of 4
(1,325 Views)
Solution
Accepted by topic author Steiner_Wolfgang

I have now solved  the described problem.

You have to search in the word document for InlineShapes (ActiveX Controls like Textboxes or Checkboxes are in a word document from Type InlineShape)

There you have to select OLEFormat where you get the classtype and the objectreference.

Then you have to convert the Variant - Object to the Class you need. In my case I have to Load Microsoft Forms 2.0 Object Library Version 2.0 and the Object TextBox (Forms.TextBox.1)

Then you can write to the TextBox.

 

I have attached my Example File (for LV20 and also for older LV15) if anyone else needs also a solution for this case.

 

Thanks anyway to everyone who has already replied and tried to help to find a solution!

 

  

0 Kudos
Message 4 of 4
(1,277 Views)