I’m trying to put together a script for use with Word 2015 that will allow me to change the color of the font of certain words in a document.
I found the following script that allows we to “highlight” words that I add to the script and change their case, but what I really want to do is change the font color:
tell application "Microsoft Word"
set findRange to find object of selection
tell findRange
execute find find text "you" replace with "YOU" replace replace all
execute find find text "your" replace with "YOUR" replace replace all
execute find find text "for" replace with "FOR" replace replace all
end tell
end tell
Is there a similar, simple way to achieve what I’m wanting to do? I’d like to be able to add words to the script and change the font color to red and if possible, even increase the font size.
I’m nost sure about Office 2015 or Office 2016, but in Office 2011, it is, IMO, much easier to use the Office VBA (Word VBA in this case) to manipulate the document. I find the Office VBA easy to use, whereas the Office AppleScript is always a challenge for me. Could be this is just me.
The thing with Office VBA, is that there are tons of examples available readily on the Internet.
Not so much with Office AppleScript.
My approach is this:
If I need to automate multiple, non-Microsoft, apps, then I use AppleScript
If I need to automate one or more Microsoft Office apps, I use Office VBA