images Property

       

Returns an IHTMLElementCollection collection that represents the collection of all images in the current document. Images are denoted by their HTML tag <IMG>.

expression.images

expression   Required. An expression that returns a DispFPHTMLDocument object.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example creates a reference to the images collection and displays the titles of all images in the current document. If no titles exist for any of the images, nothing is displayed to the user.

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