How to check the selection is empty after cut?

B

Ben

Hi,

I have the macro that use vba to select the whole text of the current
document consider of a lot of pages and do cut and paste to a new document
as separate pages. But the problem is if my current document is a blank
document, how do i check that it is a blank and the macro will not select
and do cut and paste as i have encountered run time error when the current
document is blank.

please advise. thanks.
regards,
ben
 
C

Chuck

A blank document has a length of 1 (the paragraph mark). So test if the
length of the document = 1:

If Len(ActiveDocument.Range) = 1 Then
'document is blank
'do nothing
Else
'work your magic
End If
 

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