View Single Post
 
Old 05-23-2014, 10:32 AM
RupertM RupertM is offline Windows 7 64bit Office 2013
Novice
 
Join Date: May 2014
Posts: 3
RupertM is on a distinguished road
Default Changing color font between 2 specific flags

Hi everyone,

Just as a brief introduction, I'm comfortable using VBA on Excel and doing all sorts of interesting stuff, but I never used VBA on Word. I am currently struggling with the following situation:

what I'd like to, is to build a macro that will change color (and size) for the text between 2 specific flags.

For example, if my text is:
Et quoniam mirari posse quosdam peregrinos existimo haec lecturos forsitan, si contigerit, quamobrem cum oratio ad ea monstranda deflexerit quae Romae gererentur.
/Ex: nihil praeter seditiones narratur et tabernas et vilitates harum similis alias, summatim causas perstringam nusquam a veritate sponte propria digressurus./Ex


I want Word to see the flag "/Ex:" and to apply a specific change in color and size to all the text between "/Ex:" and the second flag "/Ex". (And that for the whole document of course.)

I've no idea where to start with. I browsed the net but only found topics that use a find/replace function which is not applicable in my case I think.
I also thought about a macro built like a loop, selecting each word and checking if it's a flag or not, but first, I don't really know how to compute it, and second I don't think this is a very optimized solution.

I will appreciate any kind of help!
Thanks
Reply With Quote