Mobile menu

Macro for replacing colors in Word 97 (VB)
Thread poster: Cecilia Falk

Cecilia Falk  Identity Verified
Local time: 07:23
English to Swedish
Jan 21, 2005

Hello,
I often use colors when manipulating my translations in order to mark out
various things (text not to be spellchecked, etc) so I often have to search
and replace colors.
In order to skip all the steps in the Search and Replace dialog evertime I
want to do this I am now trying to write a macro which is basically a
dialogbox with two sets of option buttons for all the colors and what I
would like to happen is that you for example check the option button for
"Blue" in the first set and the the option button for "Green" in the second
set and then click OK in order to replace all Blue text with Green.
I am only an amateur when it comes to macros and I am stuck at what code to
write for the Command button "OK" to make this happen. Does anybody have a
quick tips, an URL or something. I have been reading my hanbbok for VBA,
but can't find anything there or in the help that I understand;-)
Or maybe there is an even easier way to accomplish this?

Best regards,
Cecilia


[Edited at 2005-01-21 00:19]


Direct link Reply with quote
 

Jabberwock  Identity Verified
Poland
Local time: 07:23
Member (2004)
English to Polish
Let's try this... Jan 21, 2005

I didn't test it yet, as it would requiring preparing the dialog form etc., but the following set of instructions should work:

With ActiveDocument.Content.Find
.ClearFormatting
.Font.ColorIndex = Color1
.Text = ""
With .Replacement
.ClearFormatting
.Font.ColorIndex = Color2
.Text = ""
End With
.Execute Format:=True, Replace:=wdReplaceAll
End With

Color1 and Color2 are the values set by the appropriate dialog box items. The instruction replaces the colors only in the main text (story). For headers, footers etc. this would require a loop.

This is for Word 2000, but I think it should work the same as for Word 97.

Some time later I might write the whole procedure, but I guess you would prefer finishing it yourself, it's much more fun! And the knowledge you get will help you more useful macros.

[Edited at 2005-01-21 02:24]


Direct link Reply with quote
 

Cecilia Falk  Identity Verified
Local time: 07:23
English to Swedish
TOPIC STARTER
Thank you! Jan 24, 2005

I recieved some other suggestions also from other sources, so my next step will be to try them all to see which one I get to work

Thanks again, it is great to be able to ask questions like this when you are completely stuck!

Best regards,
Cecilia


Direct link Reply with quote
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Macro for replacing colors in Word 97 (VB)

Advanced search






PerfectIt consistency checker
Faster Checking, Greater Accuracy

PerfectIt helps deliver error-free documents. It improves consistency, ensures quality and helps to enforce style guides. It’s a powerful tool for pro users, and comes with the assurance of a 30-day money back guarantee.

More info »
CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use SDL Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

More info »



All of ProZ.com
  • All of ProZ.com
  • Term search
  • Jobs