coords Property

Microsoft FrontPage Visual Basic

coords Property

Returns or sets a String that represents the coordinates of an AREA element within a MAP element.

expression.coords

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

Remarks

The format of the String value of the coords property depends on the value of the Shape property (corresponding to the shape attribute) as follows:

shape property coords property
SHAPE = "circ" or "circle" COORDS = "x1,y1,r" – Where x1,y2 are the coordinates of the center of the circle, and r is the radius of the circle.
SHAPE = "poly" or "polygon" COORDS = "x1,y1,x2,y2...xn,yn" – Where each x,y pair contains the coordinates of one vertex of the polygon.
SHAPE = "rect" or "rectangle" COORDS = "x1,y1,x2,y2" – Where x1,y1 are the coordinates of the upper-left corner of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle.

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