
Tips.Net > WordTips Home > Formatting > Character Formatting > Changing Character Color with WordBasic
Summary: Presents a handy little WordBasic macro that changes the color of the selected text. (Came in real handy before Word provided a Font Color tool.) (This tip works with Microsoft Word 6, and Word 95.)
Imagine that you are developing a document that uses text colors to signal special meanings to the reader. For instance, you may use red text to indicate what the user should type. If you are developing a document in which you use color within your text, it can be a real bother to use the menus over and over again to change text colors. In such an instance, it is helpful to have a macro that modifies the color automatically. You can assign the macro to a key combination or a toolbar button so you don't have to use the menus. The following WordBasic macro changes the color of the currently selected text to red.
Sub MAIN
InSelection = SelType()
If InSelection = 2 Or InSelection = 6 Then
FormatFont .Color = 6
Else
Beep
End If
End Sub
Tip #252 applies to Microsoft Word versions: 6 95
Create and Merge! Using Word's mail merge tool you can quickly and easily combine data from a variety of data sources to create great individualized documents that incorporate your data in ways that you control. WordTips: Mail Merge Magic is an invaluable source for learning how to harness the full power of Word's mail merging capabilities.
Check out WordTips: Mail Merge Magic today!
Learn to search for and replace text, formatting, graphics, and special characters the easy way with WordTips: Find and Replace. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips