In VBA the default property is NameLocal ? sName = objStyle Note that Styles(1) is the first style in the alphabetic list. The style index number represents the position of the style in the alphabetically sorted list of style names. Set objStyle = ActiveDocument.Styles( wdBuiltInStyle.wdStyleNormal) If you are using the style name it must match the spelling and spacing of the style name exactly, but not necessarily its capitalization. Set objStyle = ActiveDocument.Styles("Color") Use Styles(index), where index is a style name, a wdBuiltinStyle constant or index numberĪctiveDocument.Styles("Normal") = oStyle If you want to modify styles in a template, use the OpenAsDocument method to open the template as a document Dim objStyle As Styleįor Each objStyle In ActiveDocument.Styles You can use the Styles property to return the Styles collection. This only works for selections, not for ranges. To customize more advanced formatting, click the Format button and select a category from the menu.A style represents either a built-in style or a user defined style.
Format the selected text the way you’d like it to appear in your style.The new style will inherit the formatting of the original style, as well as any changes made to the original style later. You can also base a style on another style. List: Applies similar alignment, numbering or bullet characters and fonts to lists.Table: Provides a consistent style for all borders, shading, alignment and fonts in tables.These styles will be applied to entire paragraphs as well. Linked: Uses a combination of character and paragraph formatting properties.These styles will be applied to entire paragraphs. Paragraph: Includes any type of paragraph formatting, such as paragraph, tab, border, and bullets and numbering formats.These styles can be applied to any selected text. Character: Includes any type of character formatting, such as font size, type, color, and effects.There are five different types of styles: If the need arises, creating a style is quick and easy. You can also create your own styles, saving a set of formatting to use easily in other places. This style is automatically applied when text is used in a numbered or bulleted list. These styles are meant for text used to cite references and book titles. Subtle Reference, Intense Reference, Book Title These styles will separate blocks of text to display a quote.
Emphasis usually italicizes, Strong usually bolds, and Intense Emphasis will usually do both. These styles are meant to emphasize text in a document. Subtitle text, styled to complement the Title style, along with an additional style for emphasis. Three levels of headings to use in your document, with outline levels automatically applied.Ī larger heading, useful for the main title of a document. Normal text, with no additional spacing between paragraphs. Any text not using another style is set in Normal.
The document looks professional and is easy to read.
Using styles and style sets rather than formatting ad hoc has several advantages: A style is a group of formatting settings stored under a single name.