images 属性

       

返回 IHTMLElementCollection 集合,该集合代表当前文档中所有图像的集合。图像用其 HTML 标记 <IMG> 表示。

expression.images

expression  必选。返回 DispFPHTMLDocument 对象的表达式。

说明

此集合先按名称索引,再按标识符索引。如果发现相同的名称,则返回具有该名称的项目的集合。相同名称的集合随后必须按位置序号进行引用。

示例

下列示例创建对图像集合的引用,并显示当前文档中所有图像的标题。如果没有任何图像标题,则不会向用户显示任何内容。

Sub ReturnImages()
'Returns the collection of all images in the collection

    Dim objApp As FrontPage.Application
    Dim objImages As IHTMLElementCollection
    Dim objImage As IHTMLElement

    Set objApp = FrontPage.Application
    Set objImages = objApp.ActiveDocument.images

    For Each objImage In objImages
        'If title string is not empty
        If Not objImage.Title = "" Then
            'Display title of each image
            MsgBox objImage.Title
        End If
    Next objImage

End Sub