useMap Property

Sets or returns a String that represents the name, often with a bookmark extension (#name), to use as a client-side image map for an image.

expression.useMap

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

The following example replaces the text in the active document with a graphic, and then inserts an image map with one AREA element and specifies its share, coordinates, and hyperlink URL.

Sub SetImageCoords()
    Dim objImage As FPHTMLImg
    Dim objArea As FPHTMLAreaElement
    
    ActiveDocument.body.innerHTML = _
        "<img src=""graphics/chelan.jpg"" id=""chelan"">" & vbCrLf
    
    Set objImage = ActiveDocument.all.tags("img").Item("chelan")
    objImage.useMap = "#ImageMap"
    
    ActiveDocument.body.insertAdjacentHTML where:="beforeend", _
        HTML:="<map name=""ImageMap"">" & vbCrLf & _
        "<area id=""Area1"">" & vbCrLf & "</map>" & vbCrLf
    Set objArea = ActiveDocument.body.all.tags("area").Item("Area1")
    
    With objArea
        .Shape = "rect"
        .coords = "5, 16, 151, 286"
        .href = "http://www.microsoft.com"
    End With
        
End Sub

Applies to | FPHTMLImg Object | IHTMLImgElement Object