by Allen Wyatt
(last updated January 4, 2014)
Word allows you to use styles to format both paragraphs and individual characters in your document. These styles can greatly simply the consistent application of formatting across an entire document. If you are writing a VBA macro, you may have a need to determine the name of the style applied to a particular paragraph. You can do that by using the Style property with a Paragraph object, as follows:
sParStyle = ActiveDocument.Paragraphs(J).Style
When this line is executed, sParStyle (a string variable) will contain the name of the style used on the specified paragraph.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (824) applies to Microsoft Word 97, 2000, 2002, and 2003.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Want to know the absolute value of a number? It's easy to derive in VBA by using the Abs function.Discover More
Your macro may need to determine if the user has overtype mode turned on. You can find out the overtype status easily by ...Discover More
When working with macros, you can often speed up processing by turning off the updating of the screen. Best news is that it ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.