View Single Post
 
Old 07-13-2022, 02:55 PM
zanodor zanodor is offline Windows 10 Office 2016
Novice
 
Join Date: Jun 2022
Posts: 17
zanodor is on a distinguished road
Default On we go

Quote:
Originally Posted by zanodor View Post
...
This code should be working but it's not:
Code:
Sub Tinkering()
Application.ScreenUpdating = False
Set MyRange = ActiveDocument.Content
With MyRange.Find
        .ClearFormatting
        .Bold = True
        .Font.Size = 14
        .Text = ""
        With .Replacement
          .ClearFormatting
          .Text = "[[^&]]"
          .Font.Size = 14
        End With
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
      End With
Application.ScreenUpdating = True
End Sub
I used the Execute by itself not the Do While Found, if that means anything.

It throws an error at Bold, while that parameter looks sound.
On this forum Q'n'A a person has a similar issue but they don't correct the code (he or she gets the usual scolding while it's not his or her fault that sometimes the error is not even on the line pointed at by the debugger, mind you), instead offer a different one so one can never learn one sample routine or have some feeling of merit or self-confidence. Am I seeing a pattern here? Anyway.

It's even possible that the other method which I strive to do is not usable for what I want to do and only the copy formatting method works. I wouldn't rule it out.
Reply With Quote