FP2000: Spaces Are Added Back to HTML When You Run Macro to Remove Them (219722)



The information in this article applies to:

  • Microsoft FrontPage 2000

This article was previously published under Q219722

SYMPTOMS

When you run a macro that is designed to remove the   (spaces) from a table, the   (spaces) are added back to the HTML.

For example, when you run the following Visual Basic for Applications macro on a page with a table, the macro removes the   from the HTML:
Sub TableSpacer()
With ActiveDocument
For i = 0 To ((.all.Length) - 1)
If UCase(.all(i).tagName) = "TD" Then
If .all(i).innerHTML = " " Then
.all(i).Height = "10"
.all(i).innerHTML = ""
End If
End If
Next
End With
End Sub
However, FrontPage adds the   back to the table.

RESOLUTION

To work around this problem, use a macro that sets a specified height for the table and removes the   from the HTML.

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

The following sample macro searches for the <TD> tag, removes the &nbsp; (space), and sets the height of the cell at 9.
Sub TableDeSpacer()
With ActiveDocument
For i = 0 To .all.Length - 1
If UCase(.all(i).tagName) = "TD" Then
If .all(i).innerHTML = "&nbsp;" Then
.all(i).Height = 9
End If
End If
Next
End With
End Sub

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:8/30/2002
Keywords:kbbug KB219722