Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2014, 02:38 AM
garcanrya garcanrya is offline Find and replace with a macro, problem with letter case Windows 7 32bit Find and replace with a macro, problem with letter case Office 2013
Novice
Find and replace with a macro, problem with letter case
 
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
  #2  
Old 01-10-2014, 04:21 AM
macropod's Avatar
macropod macropod is online now Find and replace with a macro, problem with letter case Windows 7 32bit Find and replace with a macro, problem with letter case Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try adding:
.MatchCase = True
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-10-2014, 05:40 AM
garcanrya garcanrya is offline Find and replace with a macro, problem with letter case Windows 7 32bit Find and replace with a macro, problem with letter case Office 2013
Novice
Find and replace with a macro, problem with letter case
 
Join Date: Jan 2014
Posts: 2
garcanrya is on a distinguished road
Default

Thanks, macropod, this helped!
greetings,
garcanrya
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and replace with a macro, problem with letter case Is the following too complex for find/replace macro? bertietheblue Word VBA 12 11-04-2013 05:35 PM
Find - Replace Macro using a table list mdw Word 0 08-01-2013 04:36 PM
Find and replace with a macro, problem with letter case Find and Replace Format macro issue Jack Word VBA 2 12-12-2012 09:24 PM
macro or find/replace JamesVenhaus Word 2 02-27-2012 03:34 PM
Find and Replace Macro - A Better Way Tribos Word VBA 0 10-08-2008 03:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft