![]() |
|
|
|
#1
|
|||
|
|||
|
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "PATH:2 - 5AX TRIM*\<*\>*G00 Z4"
.MatchWildcards = True
Do While .Execute
oRng.Select
'or do what you wish with the range of text
Loop
End With
lbl_Exit:
Exit Sub
End Sub
|
|
#2
|
|||
|
|||
|
I don't understand why you use .Execute instead of .Find.Found. Why do you expect .Execute to mirror whatever .Find.Found ends up being? Intuitively it seems to me .Execute is a flag indicating whether or not the Find operation was done, and .Find.Found indicates whether the desired pattern was found. The Find operation could have been Executed without anything being Found. Then it seems their values should not match.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Building Block Text into a variable | tonse | Word VBA | 1 | 11-16-2023 06:10 AM |
| how to create a block text and when click on the title of block hide and unhide the block | labasritas@free.fr | Word | 4 | 09-17-2017 01:17 PM |
| What is this block of text? | nyempire | Word | 5 | 05-26-2016 06:08 AM |
| how to make building block content control determine bb to display elsewhere | jamles12 | Word VBA | 5 | 11-16-2013 11:38 AM |
| Anyway to determine time/date of text creation? | pureride | Word | 1 | 01-05-2010 02:09 PM |