Changing a Word document source

J

jic

Greetings!

We have a bunch of Word documents that were created long time ago.
One of the software that we use to translate complains about some
track changes were left without accepting or rejecting. I have a
script that supposely accepts all changes to the Word doc, but it does
not work on some of these older documents. I know how to fix this
problem by hand, but I would like to do this programmatically. The
way to fix it by hand is,

1. Open the word document
2. Go to Tools > Macro > Microsoft Script Editor
3. Use Edit > Find and Replace > Find to search for the string mso-
prop-change; you should find something like:
<p class=MsoNormal style='mso-prop-change:"John Johnson"
20071130T1052'"...
4. Remove the part style='mso-prop-change:"John Johnson"
20071130T1052'"
5. Repeat this until you do not find the string mso-prop-change
anymore
6. Save the document and close the Microsoft Script Editor

I am able to open the Script Editor by doing,

var w = WScript;
var word = w.CreateObject("Word.Application");
var doc = word.Documents.Open(file);
//msoHTMLProjectOpenSourceView 1
//msoHTMLProjectOpenTextView 2
var htmldoc = word.ActiveDocument.HTMLProject.Open(2); // This
opens the Microsoft Script Editor

But, the problem is that I would like to do this behind the scenes and
not have the Script Editor come up. I would also like to do a search
and replace on that specific document. I have searched on the
Microsoft site for a solution, but none was found.

I know how to do the search and replace, all I need is to be able to
access the xml side of the Word document.

Any ideas?

thanks,

jic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top