Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Document Management / May 2008

Tip: Looking for answers? Try searching our database.

macro copy/paste between bookmarks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MEME - 05 Apr 2008 21:28 GMT
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,
Signature

meme

Doug Robbins - Word MVP - 06 Apr 2008 02:48 GMT
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

Signature

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,
>
[quoted text clipped - 6 lines]
>
> Thank you very much for your cooperation,
MEME - 06 Apr 2008 16:06 GMT
Great, thank you
Signature

meme

> Something like
>
[quoted text clipped - 16 lines]
> >
> > Thank you very much for your cooperation,
MEME - 18 May 2008 01:17 GMT
Hi again,

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

Thank you
Signature

meme

> Great, thank you
>
[quoted text clipped - 18 lines]
> > >
> > > Thank you very much for your cooperation,
Doug Robbins - Word MVP - 18 May 2008 09:57 GMT
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

Signature

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,
>
[quoted text clipped - 27 lines]
>> > >
>> > > Thank you very much for your cooperation,
MEME - 18 May 2008 13:49 GMT
It works!

Thank you very much. It is excellent!
Signature

meme

> Try
>
[quoted text clipped - 40 lines]
> >> > >
> >> > > Thank you very much for your cooperation,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.