Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2013, 08:42 PM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default How to find&replace several items at once?


Hi!
I need to change text from one font to another but not all the symbols match up in the fonts coding. So I would like to use Find&Replace to find all the symbols I want to change and replace them at once. Is that possible?
Reply With Quote
  #2  
Old 11-28-2013, 11:13 PM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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

Yes, but you'd need to know the character codes of the characters to be replaced. If you know that, you could use a wildcard Find/Replace, where:
Find = [^0191^0233]
Replace = ^&
where the numbers following the ^ characters are the 4-digit character codes (for ¿ and ß in the above example) and you specify both the Find and Replace fonts.

If the result of doing this is that you'll have words etc. using a mix of fonts, this is not a good solution (IMHO); you'd do better to use a font that does support all of the characters in use.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-29-2013, 05:52 AM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

How do you find out character codes? And in the Replace field how do you specify what exactly you want to replace? I didn't understand that part from your example.

Fonts won't be mixed since I just need one font and just to change incorrect characters with the proper ones from the same font character map. Just some remapping has to be done.
Reply With Quote
  #4  
Old 11-29-2013, 06:04 AM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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

OK, since they're not from different fonts, you can't use the Replace expression. A different approach would be needed. That said, you should be able to find the character codes by selecting a given character and using Insert|Symbol to find its value. Alternatively, if you're willing to Find/Replace them one at a time, simply copy & paste a character into the Find box and type the replacement character into the Replace box.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-29-2013, 08:30 PM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

I'm sorry, I didn't express myself properly. The symbols I want to change are from different fonts. They are the same symbols but font mappings are different. Anyway, I tried your advice, typing character codes in the Find field but word cannot find them!

Btw. When I just copy/paste a symbol I want to replace and then change the font and put the required symbol in Replace field it works ok. I just don't want to change all the symbols one-by-one rather making a string to change them all at once.

If you don't mind and have a little time, I added text examples and those 2 fonts I'm using. There are two fonts, Tamalten and Balaram. Input text is in Tamalten and I need it to be in Balaram, with the same symbols as in tamalten font.
Attached Files
File Type: zip test.zip (64.7 KB, 14 views)
Reply With Quote
  #6  
Old 11-29-2013, 08:58 PM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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

OK, now that I can see what you have, you could use a macro like:
Code:
Sub BulkFindReplace()
Application.ScreenUpdating = False
Dim FList As String, RList As String, j As Long
FList = "¸|î|å|?|®|ß"
RList = "Ç|é|ä|ë|å|ñ"
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Format = False
  .Forward = True
  .MatchCase = True
  .MatchWholeWord = False
   'Process each item from the Find/Replace Lists
  For j = 0 To UBound(Split(FList, "|"))
    .Text = Split(FList, "|")(j)
    .Replacement.Text = Split(RList, "|")(j)
    .Execute Replace:=wdReplaceAll
  Next
End With
Application.ScreenUpdating = True
End Sub
Note that every entry in the Find list (FList) must have a corresponding entry - even if empty - in the Replace list (RList)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 11-30-2013, 03:29 AM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

Wow! Thanks man! That's what I was looking for. It works... but there is a problem. Somehow when I insert the necessary characters into the macro it will display question marks instead. Can I replace the symbols with character codes? If so then how?
Reply With Quote
  #8  
Old 11-30-2013, 04:37 AM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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

I simply copied the characters from your documents into the macro. If you have characters that won't copy that way, you'll need to provide another document, preferably with just those characters and their replacements, so I can take a look at it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 11-30-2013, 08:21 PM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

Something is wrong here. THe macro is working. When I paste those sankrit diacritic symbols, they appear as question marks, the same symbols that you were pasting. So then I tried to paste usual characters and that is fine. But the replace field I left the same as you already made. But instead of changing usual letters into those characters, word is putting russian letters instead! So something is wrong with languages here. I do have russian installed on computer, but so what? The word I use is in English although this should have nothing to do with that. And I tried two versions of Word, 2010 and 1013. Same problem.

Btw. I changed macro font into Tamaten, the first font I want to change. Still, when pasting a symbol in the same font it appears as a question mark.
Reply With Quote
  #10  
Old 12-01-2013, 04:53 AM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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

As I said in my last post, you'll need to provide another document, preferably with just those characters and their replacements, so I can take a look at it. You can attach a document to a post via the paperclip symbol on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 12-01-2013, 06:09 AM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

Ok, here are the symbols.
Attached Files
File Type: docx BalaramTamalten Symbols.docx (11.8 KB, 14 views)
Reply With Quote
  #12  
Old 12-01-2013, 02:47 PM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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:
Code:
Sub BulkFindReplace()
Application.ScreenUpdating = False
Dim FList As String| RList As String| j As Long
FList = "Å|å|®|ñ|ß|" & ChrW(&H222B) & "|Â|µ|Í|¸|" & ChrW(&H3A9) & "|È|î|Ê|†|õ|" & ChrW(&H2D9) & "|¨|" & ChrW(&H2202)
RList = "Ä|ä|å|ï|ñ|ë|À|à|Ñ|Ç|ç|É|é|Ö|ö|ì|ù|Ü|ò"
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Format = False
  .Forward = True
  .MatchCase = True
  .MatchWholeWord = False
   'Process each word from the Find/Replace Lists
  For j = 0 To UBound(Split(FList| "|"))
    .Text = Split(FList| "|")(j)
    .Replacement.Text = Split(RList| "|")(j)
    .Execute Replace:=wdReplaceAll
  Next
End With
Application.ScreenUpdating = True
End Sub
Notes: In your transliteration list, you have 'ü – ü'. Since this merely replaces the character with itself, I've omitted it. Similarly, you have a duplicate of 'ß – ñ'. The ChrW references in the code are because the characters concerned are Unicode characters not supported in the ASCII range. Also you have both 'ß – ñ' and 'ñ – ï'; it is important to process these in the correct order if you want to avoid having both 'ß' and 'ñ' converted to 'ï'. The same applies to '® - å' and 'å – ä'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 12-03-2013, 01:20 AM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

Bingo!
It works and aslo I understood why I didn't see the symbols. I had the language for non-unicode programs set to Russian. I need it to display russian characters in some text files and programs. So when it is in English, then everything works. It is a nuisance to switch the languages, but I can do it once in a while and then do a batch conversion of texts.

One small thing is still to be corrected. I tried myself but couldn't do it. The Û one has to be added.

And is it possible that at the end of the macro it will keep displaying Balaram font? Somehow I have to change it again into balarama at the end.
Reply With Quote
  #14  
Old 12-03-2013, 01:42 AM
macropod's Avatar
macropod macropod is offline How to find&replace several items at once? Windows 7 32bit How to find&replace several items at once? 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

For the 'Û', add:
& "|Û"
to the FList definition and add:
|x
to the RList definition, where 'x' is the replacement character (you don't seem to have specified it).

As for the font, the macro doesn't make any changes - it leaves everything as it found it. If the issue is that the replacement characters are in the wrong font, insert:
.Replacement.Font.Name = "Balaram"
after:
.MatchWholeWord = False
and change:
.Format = False
to:
.Format = True
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 12-03-2013, 05:52 AM
Srivas Srivas is offline How to find&replace several items at once? Windows XP How to find&replace several items at once? Office 2007
Novice
How to find&replace several items at once?
 
Join Date: Mar 2010
Posts: 11
Srivas is on a distinguished road
Default

Thank you very very much, now everything works perfectly!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find&replace several items at once? How do I find and replace multiple items at once? redzan Word VBA 1 05-16-2013 08:25 AM
Find and Replace kjxavier Word 1 03-31-2012 06:57 PM
How to find&replace several items at once? Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
How to find&replace several items at once? Is there a way to use "find/replace" to find italics words? slayda Word 3 09-14-2011 02:16 PM
How to find&replace several items at once? Help with find and replace or query and replace shabbaranks Excel 4 03-19-2011 08:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:32 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