Select variable range 
Author Message
 Select variable range

I'm sure this is a no-brainer for most:

I am trying to select (and delete) a variable length string of text
downloaded from a web database.  The range always begins at the start of the
document and ends after a constant and unique phrase (e.g. "EndText").

How do I select the range between the starting and ending points?

Thanks in advance!



Sun, 27 Mar 2005 04:20:50 GMT  
 Select variable range
Hi Timothy,

You can use the following to delete that range:

Dim oRng As Range
With Selection
    .HomeKey unit:=wdStory
    With .Find
        .ClearFormatting
        .Text = "EndText"
        .Execute
        Set oRng = ActiveDocument.Range _
            (Start:=ActiveDocument.Range.Start, _
            End:=Selection.Range.End)
    End With
End With
oRng.delete

HTH


Quote:
> I'm sure this is a no-brainer for most:

> I am trying to select (and delete) a variable length string of text
> downloaded from a web database.  The range always begins at the start of
the
> document and ends after a constant and unique phrase (e.g. "EndText").

> How do I select the range between the starting and ending points?

> Thanks in advance!



Sun, 27 Mar 2005 04:39:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How do I select a constant time range from a variable time range using VBA

2. How do I select a constant time range from a variable time range using VBA?

3. passing date variable in select statment of recordset variable

4. Query to select a table to use dependant on date range entered

5. Trying to obtain the screen xy coordinates of a range of selected cells

6. Difference between select and activate... range

7. range.select query

8. Range.select query

9. selecting an unknown range of text

10. Using ranges or would it be select?

11. AutoFilter and range selecting

12. Return ONLY selected paragraphs within a range that includes a table

 

 
Powered by phpBB® Forum Software