![]() |
|
#1
|
|||
|
|||
|
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 ............ |
|
#2
|
||||
|
||||
|
Bold is a toggle command so applying it once makes things bold, applying it again makes it unbold.
Instead, apply a style which happens to be bold. Then it won't matter how many times you apply it to the same text
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#3
|
||||
|
||||
|
Which is what the built-in 'Strong' Character Style is.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#4
|
|||
|
|||
|
Thaaaaaaaaaaaaaaanks
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Word VBA code unable to find Bookmark | Useful | Word VBA | 9 | 07-19-2023 10:42 PM |
Find and Replace Code Not Working
|
falcios | Word | 11 | 06-23-2021 12:39 AM |
PRINT field code in Word document not working as expected
|
smccaffr39 | Word | 3 | 02-19-2020 02:46 PM |
VBA Code for Grammar Check Not Working in Word 2016
|
PSSMargaret | Word VBA | 2 | 06-11-2016 10:53 PM |
| MS Word Find and Replace not working | allenglishboy | Word | 10 | 07-25-2012 08:05 AM |