how to find an empty line? Issue w/ "ActiveDocument.Bookmarks("\Line").EmptyThen"

A

akh2103

Hi--I am trying to write code that loops until it hits an empty line.
I tried to use microsoft's suggested code for this, but it returns
TRUE when there is formatting on the line (even if there is no
string). How can I modify this to return false if there are no
characters on the line, even if the line has been formatted with
indents.

Sub IsLineEmpty()

If ActiveDocument.Bookmarks("\Line").Empty Then
MsgBox "The current line is empty."
Else
MsgBox "The current line is not empty."
End If

End Sub
 
D

David Sisson

How about....

   Sub IsLineEmpty()

      If ActiveDocument.Bookmarks("\Line").Empty Then
if Len(ActiveDocument.Bookmarks("\Line")) < 1 then
          MsgBox "The current line is empty."
end if
      Else
         MsgBox "The current line is not empty."
      End If

   End Sub

Not tested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top