• Change to lowercase VBA (Word 2000/2002)

    Author
    Topic
    #388507

    Now that I have my find and replace working from other answers I’ve gotten, how can I change text found with the following to all lowercase? All I see is the ALLCAPS option. I can see that you could use that and then “Selection.Range.Case = wdNextCase” to get to what I want, but it seems there should be a more direct way.

    Also, it appears the help file is correct, that even though Matchcase=false, it is fixed at true when using wildcards?

    ActiveDocument.Tables(1).Select
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = “([1-9]{3}[bkm ]{3}L2 Cache)”
    .Replacement.Text = “^&”
    .Forward = True
    .Wrap = wdFindContinue
    .Replacement.Font.Size = 6
    .Replacement.Font.Color = wdColorAqua
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Collapse

    Viewing 0 reply threads
    Author
    Replies
    • #682405

      If you select Format | Font… interactively, you will see that AllCaps and SmallCaps are the only formatting properties that involve case; there is no LowerCase or ProperCase format. So AFAIK there is no way of setting lower case as integral part of Find/Replace.

      Instead of setting AllCaps and then Selection.Range.Case = wdNextCase, you can also set Selection.Range.Case = wdLowerCase directly.

      And yes, if you search with wildcards, the search is case sensitive, as you can find out by doing an interactive search.

    Viewing 0 reply threads
    Reply To: Change to lowercase VBA (Word 2000/2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: