![]() |
|
|
|
#1
|
||||
|
||||
|
Graham's Macro3 code would be faster than the earlier alternatives of stepping through every paragraph.
I would suggest using InStr instead of .Start to get a bit more flexibility in where the found string might appear. Code:
Sub Macro4()
Dim oRng As Range
Dim sText As String, sFind As String
sFind = "010" & Chr$(9)
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:=sFind)
sText = oRng.Paragraphs(1).Range.Text
If InStr(sText, sFind) = 1 Then
MsgBox sText
End If
oRng.Collapse 0
Loop
End With
lbl_Exit:
Set oRng = Nothing
Exit Sub
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to extract a word from an excel string with various lengths
|
keywestsue | Excel | 3 | 09-18-2015 07:32 AM |
| How to extract only numbers from a STRING? | Learner7 | Excel | 3 | 07-02-2013 06:25 AM |
Extract Numbers from Alphanumeric String
|
OTPM | Excel | 6 | 05-13-2011 12:52 AM |
| Extract numbers from a text string | aleale97 | Excel | 4 | 02-10-2011 10:33 AM |
| Extract from String using Wildcard | whousedmy | Word | 0 | 05-21-2009 01:35 AM |