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!
Using a macro to format your document (or portions of your document) is not all that uncommon. If you want your macro to ...Discover More
Toolbar buttons can have a different appearance depending on their state—whether they have been clicked or not. This ...Discover More
If your documents include words that contain numbers (such as a list of parts numbers) you may need a way to increment those ...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.