Delete blank lines at end of document

U

USAFA

I am trying to set up a macro that goes to the end of a document and deletes
the last 5 lines of the document (including a page break). The documents
vary in size so this macro needs to perform this function regardless of the
document size. I'm just learning how to write code, so I'd appreciate help
with this.
 
H

Helmut Weber

Hi,

in case you are talking of paragraphs,
not of lines
whether they are empty or not:

Dim l As Long
For l = 1 To 5
ActiveDocument.Paragraphs.Last.Range.Delete
Next

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
U

USAFA

Helmut,
You've helped me once before & I thank you again for this info. And yes, I
meant paragraphs.

Cheers!
USAFA
 

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