返回 IHTMLElementCollection 集合对象,该对象代表当前文档中所有的 EMBED 元素。EMBED 元素允许您在文档中嵌入任何类型的文档。
expression.embeds
expression 必选。返回 DispFPHTMLDocument 对象的表达式。
下列示例返回 EMBEDS 集合,并显示文档中嵌入元素的数量。如果没有元素,则向用户显示一条消息。
Sub EmbedsInfo()
'Returns and displays information about
'the EMBEDS elements in the current document.
Dim objApp As FrontPage.Application
Dim objDoc As DispFPHTMLDocument
Dim objEmbeds As IHTMLElementCollection
Set objApp = FrontPage.Application
Set objDoc = objApp.ActiveDocument
Set objEmbeds = objDoc.embeds
'If there are EMBED elements
If objEmbeds.Length <> 0 Then
'If the length = 1
If objEmbeds.Length = 1 Then
MsgBox "There is only one " _
"embedded object in the current document."
Else
'If there are more than one
MsgBox "There are " & objEmbeds.Length - 1 & _
" embedded objects in the current document."
End If
Else
'Otherwise there are no embeds elements
MsgBox "There are no embedded objects " _
"in the current document."
End If
End Sub