Section Break question

L

LEU

As part of my macro I am coping part of the first page and them pasting it
into a new first page. There is a Section Break (Next Page) at the bottom of
every first page. My macro starts at a specific line and ends at the end of
section(1). But when it pasts it into the new document it’s duplicating the
last paragraph and Section Break onto another page. So what I end up with is
the last paragraph and section break on page one and the last paragraph and
section break again on page 2. What am I doing wrong?


Here is my copy part:

Dim myContent As String
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
oRng.Start = ActiveDocument.Paragraphs(49).Range.Start
oRng.End = ActiveDocument.Sections(1).Range.End
myContent = oRng.Text


Here is my past part:

ActiveDocument.Paragraphs(50).Range.Text = myContent
 
S

Stefan Blom

Use ActiveDocument.Sections(1).Range.End - 1; that way, you make sure not to
include the section break character in the range object that you create.
 

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