Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FP2000: Error Message: "Compile Error: Can't Assign to Read-Only Property" Using Position Property in VBA Macro to Move Table


View products that this article applies to.

This article was previously published under Q220126

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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
				


↑ Back to the top


Keywords: KB220126, kbprb

↑ Back to the top

Article Info
Article ID : 220126
Revision : 1
Created on : 12/2/2000
Published on : 12/2/2000
Exists online : False
Views : 253