FP2000: Error Message: "Compile Error: Can't Assign to Read-Only Property" Using Position Property in VBA Macro to Move Table (220126)
The information in this article applies to:
This article was previously published under Q220126 SYMPTOMS
When you attempt to move an absolutely positioned table by using a Visual Basic for Applications (VBA) macro similar to the following:
Sub TablePosition1()
Dim MyTable As FPHTMLTable
Set MyTable = ActiveDocument.all.tags("table").Item(0)
MyTable.Style.Position = "absolute"
MyTable.Style.posLeft = MyTable.Style.posLeft + 40
MyTable.Style.posTop = MyTable.Style.posTop + 100
End Sub
you may receive an error message similar to the following:
Compile error:
Can't assign to read-only property.
CAUSE
Internal implementation constraints in Internet Explorer 4.x set the Position property as read-only. This property is also read-only in FrontPage 2000.
RESOLUTION
To work around this problem, use the SetAttribute() method to move the positioning of a table.
The following sample VBA macro moves a table by 40 pixels along the x-coordinate and by 400 pixels along the y-coordinate:
Sub TablePosition2()
Dim MyTable As FPHTMLTable
Set MyTable = ActiveDocument.all.tags("table").Item(0)
Call MyTable.Style.setAttribute("Position", "absolute")
MyTable.Style.posLeft = MyTable.Style.posLeft + 40
MyTable.Style.posTop = MyTable.Style.posTop + 400
End Sub
Modification Type: | Major | Last Reviewed: | 12/2/2000 |
---|
Keywords: | kbprb KB220126 |
---|
|