
Tips.Net > WordTips Home > Macros > VBA Examples > Controlling the Italic Text Attribute
Summary: If you are formatting your document by using a macro, you may need to make some of your text italics. You do that by changing the Italic property for the selection. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)
Word allows a rich set of formatting attributes for text in a document. You can control the italic attribute in your macros by setting the value of the italic property. The syntax if you are using VBA is as follows:
Selection.Font.Italic = toggle
where toggle is either False (turns off the italic attribute) or True (turns on the italic attribute).
If you omit a toggle value, the statement will simply change the current setting of the italic attribute—italic text becomes non-italic and vice-versa.
Tip #730 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Find and Replace Almost Anything! Learn the ins and outs of the powerful search engines available in Word. Learn to search for and replace text, formatting, graphics, and special characters the easy way with WordTips: Find and Replace.
Thousands of WordTips, available for immediate download. Have all the Microsoft Word info you need, right at your fingertips. (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