FormatStyle

Syntax

FormatStyle .Name = text [, .Delete] [, .Merge] [, .NewName = text] [, .BasedOn = text] [, .NextStyle = text] [, .Type = number] [, .FileName = text] [, .Source = number] [, .AddToTemplate = number] [, .Define] [, .Rename] [, .Apply]

Remarks

Creates, modifies, redefines, applies, or deletes the specified style. You can also use FormatStyle to merge styles into the active document from its attached template. The arguments for the FormatStyle statement correspond to the options in the Style dialog box (Format menu).

To define formats for the style, follow the FormatStyle instruction with one or more of the following instructions: FormatDefineStyleBorders, FormatDefineStyleFont, FormatDefineStyleFrame, FormatDefineStyleLang, FormatDefineStyleNumbers, FormatDefineStylePara, FormatDefineStyleTabs.

To copy styles, use Organizer.

Argument

Explanation

.Name

The name of the style.

.Delete

Deletes the specified style.

.Merge

Merges styles to or from the document or template specified by .FileName, depending on the value specified for .Source.

.NewName

Specifies a new name for the style; used with .Rename.

.BasedOn

Specifies an existing style on which to base the specified style.

.NextStyle

Specifies the style to be applied automatically to the new paragraph after pressing ENTER in a paragraph formatted with the style specified by .Name.

.Type

When creating a new style, specifies the type:

0 (zero) or omitted Paragraph

1 Character

.FileName

The document or template to merge styles to or from. If .FileName is omitted and .Source is set to 1, styles are merged from the active template to the active document.

.Source

Specifies whether to merge styles to or from the active document:

0 (zero) From the active document to the file specified by .FileName

1 From the file specified by .FileName to the active document

.AddToTemplate

If 1, corresponds to selecting the Add To Template check box.

.Define

Redefines an existing style or creates a new style with the formats specified in subsequent instructions.

.Rename

Renames the style specified by .Name to the name specified by .NewName.

.Apply

Applies the style to the selected paragraphs.


Examples

This example applies the Normal style to the selected paragraphs and is equivalent to the NormalStyle statement:


FormatStyle .Name = "Normal", .Apply

The following example defines the character formatting of the "TestMe" style as 10-point, bold, and small caps. Word creates the style if it does not already exist.


FormatStyle .Name = "TestMe", .Define
FormatDefineStyleFont .Points = "10", .Bold = 1, .SmallCaps = 1

See Also

CountStyles(), Organizer, FormatDefineStyleBorders, FormatDefineStyleFont, FormatDefineStyleFrame, FormatDefineStyleLang, FormatDefineStyleNumbers, FormatDefineStylePara, FormatDefineStyleTabs, NormalStyle, Style, StyleName$()