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: Spaces Are Added Back to HTML When You Run Macro to Remove Them


View products that this article applies to.

This article was previously published under Q219722

↑ Back to the top


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.

↑ Back to the top


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

↑ Back to the top


Status

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

↑ Back to the top


Keywords: KB219722, kbnofix, kbbug

↑ Back to the top

Article Info
Article ID : 219722
Revision : 1
Created on : 8/30/2002
Published on : 8/30/2002
Exists online : False
Views : 307