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 / January 2006

Tip: Looking for answers? Try searching our database.

SELECTION BETWEEN

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarcoPolo - 24 Jan 2006 20:24 GMT
i need to select a part of a text of an active document starting from "A)"
till "B)"
and copying this selection into a text file

i know how to use txt files but how can i select ?
Dave Lett - 24 Jan 2006 20:40 GMT
Hi,

You can use something like the following:

Dim oRngStart As Range
Dim oRngEnd As Range
Dim oRngToCopy As Range
With Selection
   .HomeKey Unit:=wdStory
   With .Find
       .ClearFormatting
       .Text = "A)"
       .Execute
       
       Set oRngStart = Selection.Range
       Selection.MoveRight
       
       .Text = "B)"
       .Execute
       Set oRngEnd = Selection.Range
   End With
End With
       
Set oRngToCopy = ActiveDocument.Range(Start:=oRngStart.End,
End:=oRngEnd.Start)
oRngToCopy.Select

HTH,
Dave

> i need to select a part of a text of an active document starting from "A)"
> till "B)"
> and copying this selection into a text file
>
> i know how to use txt files but how can i select ?
 
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.