Sign in to follow this  
Followers 0
vietxd

Track changes option in Word 2007

8 posts in this topic

Hi everyone,

I'm writing a script that open a new word document and go to Review -> Track changes -> Change tracking option then change the option of Insertion and Deletion to "Color only". I can use mouseclick() but it's not a good way if the other computers have different resolution. Controlsend() and Controlclick() didn't work. Pls help me find a way to do this :D.

Share this post


Link to post
Share on other sites



You could use the Word UDF (is part of the standard AutoIt install) to open the document. As a return value you get the object of the application or the document.

You then can access Word via COM.

What version of Office do you use?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'm using Office Enterprise 2007. Well open the document and get the object of that is ok, but after that how can we use COM to change those options? Can you give me an example cause i've never used COM before? Thank you for reply.

Share this post


Link to post
Share on other sites

Here is a good example for Windows 2003. It's written in VBA but should give you an idea how it works.

The Options property in the Word 2007 COM reference can be found here.

I haven't tested it myself but if you need assistance post the code you have so far and I'll try to help.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yeah thank you i found many Word 2007 COM in MSDN and trying to do it in autoIT, but it's not really the same in autoIT. I think the option to enable Track changes is TrackRevisions, but it didn't work. This is my code:

$oWordobj = _WordCreate()

$oWordopt = $oWordobj.Options

$oWordopt.InsertedTextMark = 3

;oWordobj.document.TrackRevisions = 1 (not work)

;oWordobj.document.TrackRevisions = True (not work)

edit: the InsertedtextMark worked well, the "color Only" value is 5 :D. Now the problem is enable track changes only :oops:.

Edited by vietxd

Share this post


Link to post
Share on other sites

In Word 2010 I use the following to enable change tracking:

#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.TrackRevisions = True

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

yeah it worked, thank you so much :D

Share this post


Link to post
Share on other sites

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0