Blank page

D

donbowyer

Is there a simple test to determine whether or not a worksheet / page is
blank. By blank, I mean with no text.
 
J

Jonathan West

I think this question is about Excel. You have posted to a group that deals
with VBA in Word. The Excel exports are at
microsoft.public.excel.programming. You may have a better chance of a useful
reply if you repost there.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
T

Tony Jollans

This is a Word group. If you really mean worksheet, you want to be asking in
an Excel group.

If you mean a page in a Word document the answer is really "no" as a page
isn't a structural element of a document (it's just (part of) the result of
formatting a document for a printer) However there are ways of accessing
pages, for example Selection.Bookmarks("\Page"), and you can check the
contents.

A problem in giving you code is that "no text" can mean a lot of things.
Word does not usually have blank pages so any page you look at will have
"text" even if that is just an instruction to leave the page blank (a page
break, or maybe a section break, or ...), so I'm going to have to ask you to
define blank a bit more fully.
 
D

donbowyer

Thanks Tony
More specifically, I mean document not page.
The document I need to check for being "blank" - ie no text typed in it - is
the blank one Word presents you when you first open MS Word or the one you
get when you click on "new blank document".
 
T

Tony Jollans

Rather than checking the content, perhaps ..

If ActiveDocument.Saved = True Then
' It has not been changed.

It's not quite the same thing but might meet your needs.

Otherwise, ...

If Len(ActiveDocumnet.Content) > 1 Then
' It is not empty
 
D

donbowyer

Hi again Tony

Many thanks - that's it!
If Len(doc)>1 then it's not empty is just what I needed.
Thanks again
 

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