LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to replace a word or line in a word document in CVI

I am trying to edit a word document using activeX in CVI. I want to search for a word and replace it with another. I couldn't find any functions which does the replace in wordreport.c. Could you please help me out?
0 Kudos
Message 1 of 5
(3,285 Views)
This is the LabVIEW forum. You should post this in the CVI forum.
0 Kudos
Message 2 of 5
(3,270 Views)

Hi Isn,

You will want to use the Microsoft Word 9.0 Object Library to interface with Microsoft Word.  You could then potentially be able to use the ActiveX calls provided to accomplish your goal.  The specifics on how to do this should be found in Microsoft's Documentation.

Refer to the Microsoft document entitled How to find and use Office object model documentation. In your case, you will be looking at the Vbawrd9.chm help file which I believe will be located in the C:\Program Files\Microsoft Office\OFFICE\1033\ directory.

Also refer to the Unable to Load Microsoft Excel/Word Help in LabWindows/CVI KnowledgeBase.

Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 3 of 5
(3,257 Views)

Thank you Derrick.

Reg

Lakshmi

0 Kudos
Message 4 of 5
(3,249 Views)
I found a very quick easy way to do a similar thing;
Save your document as an RTF file from wordpad (DOC does not work) with some unique tags where you need the text to be.
Open the document in as a binery file.
Find and replace the strings that you need.
Save a new copy of the document. It also works if you rename your document a DOC type file.
Done! This is so simple and fast compaired to the activeX method.
0 Kudos
Message 5 of 5
(3,241 Views)