View Single Post
 
Old 01-10-2014, 02:38 AM
garcanrya garcanrya is offline Windows 7 32bit Office 2013
Novice
 
Join Date: Jan 2014
Posts: 2
garcanrya is on a distinguished road
Default Find and replace with a macro, problem with letter case

Hello,

hope you can help me. I'm trying to tidy some xml-code with Word macros (find and replace) - don't ask me why I have to do it with Word. ;-) For some reason the replacement text starts with a capital letter. Can you tell me what's wrong with my vba?

Code:
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "AgeElement"
        .Replacement.Text = "age"
        .Forward = True
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
Why is the result: <age>26</Age>? The result I want is <age>26</age>.

Thank you very much!
-garcanrya
Reply With Quote