# Revision history [back]

Ended up doing quite a bit of analysis on what makes a Text Field different from anything else and came up with this. The key here is a lot of these fields were really small which explains the check for its height.

Sub doIt()
oPages = thisComponent.DrawPages
For n = 0 to oPages.Count-1
oPage = oPages.GetbyIndex(n)
If oPage.HasElements then
do
removedBlankField = False
For m = 0 to oPage.Count-1
oPageElement = oPage.GetByIndex(m)
if oPageElement.UINamePlural = "Text Frame" and oPageElement.Size.Height > 160 then
if Trim(oPageElement.String) = "" then
oPageElement.Parent.remove(oPageElement)
removedBlankField = True
'oPageElement.String = "I AM EMPTY"
GoTo removed
end if
End If
Next
removed:
loop until removedBlankField = False
End If
Next
End Sub


Ended up doing quite a bit of analysis on what makes a Text Field different from anything else and came up with this. The key here is a lot of these fields were really small which explains the check for its height.

Sub doIt()
oPages = thisComponent.DrawPages
For n = 0 to oPages.Count-1
oPage = oPages.GetbyIndex(n)
If oPage.HasElements then
do
removedBlankField = False
For m = 0 to oPage.Count-1
oPageElement = oPage.GetByIndex(m)
if oPageElement.UINamePlural = "Text Frame" and oPageElement.Size.Height > 160 then
if Trim(oPageElement.String) = "" then
oPageElement.Parent.remove(oPageElement)
removedBlankField = True
'oPageElement.String = "I AM EMPTY"
GoTo removed
end if
End If
Next
removed:
loop until removedBlankField = False
End If
Next
End Sub


Ended up doing quite a bit of analysis on what makes a Text Field different from anything else and came up with this. The key here is a lot of these fields were really small which explains the check for its height.

Sub doIt()
oPages = thisComponent.DrawPages
For n = 0 to oPages.Count-1
oPage = oPages.GetbyIndex(n)
If oPage.HasElements then
do
removedBlankField = False
For m = 0 to oPage.Count-1
oPageElement = oPage.GetByIndex(m)
if oPageElement.UINamePlural = "Text Frame" and oPageElement.Size.Height > 160 >160 then
if Trim(oPageElement.String) = "" then
oPageElement.Parent.remove(oPageElement)
removedBlankField = True
GoTo removed
end if
End If
Next
removed:
loop until removedBlankField = False
End If
Next
End Sub