Title Property

Microsoft Word Visual Basic

Title Property

       

Returns a String representing the title of a Web style sheet. Read/write.

expression.Title

expression   Required. An expression that returns a Sylesheet object.

Example

This example assigns titles to the first three Web style sheets attached to the active document. This example assumes that there are three style sheets attached to the active document.

Sub AssignCSSTitle()
    ActiveDocument.StyleSheets.Item(1).Title = "New Look Stylesheet"
    ActiveDocument.StyleSheets.Item(2).Title = "Standard Web Stylesheet"
    ActiveDocument.StyleSheets.Item(3).Title = "Definitions Stylesheets"
End Sub

This example creates a list of Web style sheets attached to the active document and places the list in a new document. This example assumes there are one or more Web style sheets attached to the active document.

Sub CSSTitles()
    Dim docNew As Document
    Dim styCSS As StyleSheet

    Set docNew = Documents.Add

    With docNew.Range(Start:=0, End:=0)
        .InsertAfter "CSS Name : Assigned to " & ThisDocument.Name _
            & vbTab & "Title"
        .InsertParagraphAfter
        For Each styCSS In ThisDocument.StyleSheets
            .InsertAfter styCSS.Name & vbTab & styCSS.Title
            .InsertParagraphAfter
        Next styCSS
        .ConvertToTable
    End With
End Sub