Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2017, 03:58 PM
onlywonderboy onlywonderboy is offline Issue with Accented Letter Replacement (Upper/Lower Case) Windows 7 64bit Issue with Accented Letter Replacement (Upper/Lower Case) Office 2013
Novice
Issue with Accented Letter Replacement (Upper/Lower Case)
 
Join Date: Feb 2017
Posts: 5
onlywonderboy is on a distinguished road
Default Issue with Accented Letter Replacement (Upper/Lower Case)

Hey all,



I'm using a macro that strips out special characters from word documents. This is the code I've been using for find and replace:
Code:
With Selection.Find
.ClearFormatting
.Text = "Á"
.Replacement.ClearFormatting
.Replacement.Text = "A"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With

With Selection.Find
.ClearFormatting
.Text = "á"
.Replacement.ClearFormatting
.Replacement.Text = "a"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
This has worked with most characters, but I'm having an issue with accented characters. Both Á and á are being replaced with A (instead of A and a respectively). Anyone have any suggestions on how to resolve this? Thanks!
Reply With Quote
  #2  
Old 12-21-2017, 08:57 PM
macropod's Avatar
macropod macropod is offline Issue with Accented Letter Replacement (Upper/Lower Case) Windows 7 64bit Issue with Accented Letter Replacement (Upper/Lower 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

You need to tell Word to match the Find/Replace case:
Code:
With Selection.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .MatchCase = True
  .Wrap = wdFindContinue
  .Text = "Á"
  .Replacement.Text = "A"
  .Execute Replace:=wdReplaceAll
  .Text = "á"
  .Replacement.Text = "a"
  .Execute Replace:=wdReplaceAll
End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
lower/upper xor Excel 0 09-01-2016 07:46 AM
No upper and lower borders Diane Word 2 04-25-2014 10:31 PM
Issue with Accented Letter Replacement (Upper/Lower Case) Regular expressions: lower case after hyphen SusanG Word 2 06-06-2012 11:58 PM
Issue with Accented Letter Replacement (Upper/Lower Case) From all UPPER CASE to Proper Case davers Word 1 04-30-2009 12:41 PM
Upper to lower case jd Excel 1 04-28-2006 07:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:41 PM.


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