返回 FPHTMLStyleSheetsCollection 集合,该集合代表当前文档中所有样式表的集合。
expression.styleSheets
expression 必选。返回 DispFPHTMLDocument 对象的表达式。
导入的样式表包含在 <STYLE> 元素中,并可以通过 imports 集合来使用。
下列示例创建对当前文档样式表集合的引用,并显示集合中每个样式表的标题(如果存在)。
Sub ReturnStyleSheets()
'Returns a collection of a style sheets in the document
Dim objApp As FrontPage.Application
Dim objStyleSheets As FPHTMLStyleSheetsCollection
Dim objStyleSheet As FPHTMLStyleSheet
Set objApp = FrontPage.Application
Set objStyleSheets = objApp.ActiveDocument.styleSheets
'For each style sheet in the document
For Each objStyleSheet In objStyleSheets
'if it has a title, display it
If objStyle.Title <> "" Then
MsgBox objStyleSheet.Title
End If
Next objStyleSheet
End Sub