Ordinarily that means a nonprintable character, for example,
a manual page break, or the end-of-cell marker in a table
both show up like that if you display them in a MsgBox.
If you know the character you want to test for, you need
to use its ASCII code. For example, this:
If Asc(ActiveDocument.Characters(1).Text) = 12 Then ...
would catch ASCII 12, a page break.
But to simply test for an empty document, just use:
If Len(ActiveDocument.Range) = 1 Then...
(An empty doc contains one chararacter, a paragraph mark.)
Note that this won't look to see if there's anything in the
header/footer layer or in textboxes, footnotes, etc. If you
need this, post back.
--
Mark Tangard <
[email protected]>, Microsoft Word MVP
Please reply ONLY to the newsgroup, not by private mail.
Note well: MVPs do not work for Microsoft.
"Life is nothing if you're not obsessed." --John Waters
Dumb question, sorry. If ActiveDocument.Words(1).Text = "[box]", where
[box] is a square box, what does that mean? I want to test for an empty
document, but for ActiveDocument.Words(1).Text, I get this "[box]". How can
I code for:
If ActiveDocument.Words(1).Text = "[box]" ... (blah, blah)
TIA