Share via


Themes Collection

SharePoint Designer Developer Reference

A collection of Theme objects.

Remarks

Each Theme object represents a theme associated with an HTML page or a Web site in Office SharePoint Designer. The Theme object is a member of the Themes collection.

Use the Themes property to return the Themes collection. The Themes property can be used with either the Application or the Web object. The Themes property for the Application object is the collection of themes available in Office SharePoint Designer. The Themes property for the Web object is the collection of themes applied to the files within a Web site, or the collection of themes applied to a Web site. The following statement illustrates both the Themes and Count properties and returns the number of items in the Themes collection that are available in Office SharePoint Designer.

Visual Basic for Applications
myTotalThemeCount = Application.Themes.Count

The following statement returns the number of themes within the active Web site.

Visual Basic for Applications
myWebThemeCount = ActiveWeb.Themes.Count

Use Themes(index), where index is the index number of a theme item, to return a single Theme object. The following statement returns the first theme in the Themes collection.

Visual Basic for Applications
myThemeOne = Application.Themes(0)

Use the Application property to return the Application object. The following example returns the version and build number of Office SharePoint Designer from within the Themes collection.

Note

To run this procedure you must have at least one open Web site.

Visual Basic for Applications
Private Sub GetBuildNumber()
    Dim myThemes As Themes
    Dim myBuild As String
    Set myThemes = ActiveWeb.Themes
    myBuild = myThemes.Application.Build
End Sub

Use the Parent property when you want to return the container for the Themes collection. For example, the following statement returns the URL associated with the parent container of the Themes collection.

Visual Basic for Applications
myParentUrl = ActiveWeb.Themes.Parent.Url

See Also