Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Dec 2001
    Location
    Santa Barbara, California, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change to lowercase VBA (Word 2000/2002)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Change to lowercase VBA (Word 2000/2002)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •