macro copy/paste between bookmarks

  • Thread starter Thread starter MEME
  • Start date Start date
M

MEME

Hi,

I'm using word 2003 - I have a file. I have two bookmarks. I need to copy
and paste the text in between the two bookmarks and append it at the end of
the file.

Can you help to program a macro to do that?

Thank you very much for your cooperation,
 
Something like

Dim myrange As Range
With ActiveDocument
Set myrange = .Range
myrange.start = .Bookmarks("FirstBookMark").Range.End + 1
myrange.End = .Bookmarks("SecondBookMark").Range.start - 1
.Range.InsertAfter myrange.FormattedText
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Great, thank you
--
meme


Doug Robbins - Word MVP said:
Something like

Dim myrange As Range
With ActiveDocument
Set myrange = .Range
myrange.start = .Bookmarks("FirstBookMark").Range.End + 1
myrange.End = .Bookmarks("SecondBookMark").Range.start - 1
.Range.InsertAfter myrange.FormattedText
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Hi again,

It was working until a table was in the text! it is loosing the format.
Only the text is copied!

Thank you
 
Try

Dim myrange As Range
With ActiveDocument
Set myrange = .Range
myrange.start = .Bookmarks("FirstBookMark").Range.End + 1
myrange.End = .Bookmarks("SecondBookMark").Range.start - 1
myrange.Copy
Set myrange = .Range
myrange.Collapse wdCollapseEnd
myrange.Paste
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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

Back
Top