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 / Programming / July 2007

Tip: Looking for answers? Try searching our database.

copy paste a range of text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FIRSTROUNDKO - 12 Jul 2007 21:41 GMT
Hi!

How do I copy a range text abc to xyz not in the same paragraph
to a new document

abc........
..........

.........
..........

xyz

thanks in advance
Doug Robbins - Word MVP - 13 Jul 2007 02:13 GMT
Use

   Dim myrange As Range
   Set myrange = ActiveDocument.Range
   myrange.start = myrange.start + InStr(myrange, "abc") - 1
   myrange.End = myrange.start + InStr(myrange, "xyz") + 2
   myrange.Copy

without the -1 and the +2, what will be copied starts with the b of abc and
ends with the x of xyz.  You will need to make an appropriate adjustment to
get exactly what you want.

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 - 10 lines]
>
> thanks in advance
FIRSTROUNDKO - 13 Jul 2007 14:39 GMT
HI

all I get is abcxyz, and not th text inbetween

Thanks

Darren

>Use
>
[quoted text clipped - 13 lines]
>>
>> thanks in advance
Doug Robbins - Word MVP - 14 Jul 2007 04:37 GMT
That's not what happens when I run the code.

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 - 23 lines]
>>>
>>> thanks in advance
 
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.