Finding text in a Word document, by "color index"

I am trying to carry out a [Find & Replace] within a Word document where the only constant feature of the text is that it is coloured blue. There are other slightly less definable constants but as Applescript doesn’t seem to support wildcards, I’ve struggled to make anything else work.

The situation is; I am sent a lot of well structured documents to process and I have managed to automate a large proportion of the work (though I am sure, pretty inelegantly!) but this last bit is eluding me. I have to remove a series of instructions (from the Designer) and the text is always coloured using the blue in MS Word.

The code I have tried so far is:


(* *** “Fix Manual Text” Script *** *)

tell application “Microsoft Word”
activate

set docRange to text object of active document

clear formatting of find object of docRange
execute find find color index of font "Blue" replace with "" replace replace all

end tell


Please, could someone let me know where I am going wrong and how to correct it?

thanks

Chris Bunnett

Model: MacBook Pro
AppleScript: 2.0.1
Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)

Fantastic. This seems to have worked!!

Thank you so very much. I’ll go through it and try to understand how you got to this: it is very different to what I though I understood in writing these scripts.

'til then

Chris

There is no response to your question!
Was it removed?
I was hoping for an answer.

1 Like