I can't help you with the Lisp but here's to try for VBA.
Create a block with attributes;
1. for Area Tag: AREA
2. for Perimeter Tag: PERIMETER
Then run this macro
Code:
Sub PerimeterAreaBlock()
Dim strObjectID As String
Dim xBlock As AcadBlockReference
Dim objPolyline As AcadLWPolyline
Dim varAttribs As Variant
On Error Resume Next
ThisDrawing.Utility.GetEntity xBlock, pt1, "Select Block"
If Err Then Exit Sub
ThisDrawing.Utility.GetEntity objPolyline, pt1, "Select polyline"
If Err Then Exit Sub
strObjectID = ThisDrawing.Utility.GetObjectIdString(objPolyline, False)
AreaFieldStr = "%<\AcObjProp.16.2 Object(%<\_ObjId " & strObjectID & ">%).Area \f ""%lu2%pr2%ps[, m²]%ct8[1e-006]"">%"
LengthFieldStr = "%<\AcObjProp.16.2 Object(%<\_ObjId " & strObjectID & ">%).Length \f ""%lu2%pr2%ps[, m]%ct8[0.001]"">%"
varAttribs = xBlock.GetAttributes
For i = 0 To UBound(varAttribs)
Select Case varAttribs(i).TagString
Case "PERIMETER"
varAttribs(i).TextString = LengthFieldStr
Case "AREA"
varAttribs(i).TextString = AreaFieldStr
End Select
Next
ThisDrawing.Regen acActiveViewport
End Sub
I think this is better than to extract (but its also possible) the ObjectID from the field expression of the area attribute. The defining polyline is still there right? Or else the field wont work. What do you think?