View Single Post
 
Old 11-21-2024, 05:13 AM
capitala capitala is offline Windows 7 64bit Office 2003
Advanced Beginner
 
Join Date: Nov 2013
Posts: 38
capitala is on a distinguished road
Default Find code is not working in some word lines

Good day! I beg your patience:

I made a code in (word VBA) to search for the letter ':' and then do something (like Bold format)

the code is working perfect in tables. BUT in a normal text, if there's two ':' in the same line, the full line is excluded from the action.
Example:

Before Code:

Name:

Nationality:

Address: City:

ID No.:



After Code:

Name:

Nationality:


Address: City:

ID No.:



as you see, in the line starting with: Address, no effect at all



Here's the code:

Dim bWC As Boolean
Dim oRng As Word.range
Set oRng = ActiveDocument.range
With oRng.Find
.MatchWildcards = True
.Text = ":"
.Format = True
.Wrap = wdFindStop

While .Execute
oRng.Select
............
Reply With Quote