From: data.file on 6 Jan 2010 10:52 I am grappling with using the search / replace functionality in Word with the so called decorative fonts. The object is to be able to create macros to process sets of symbols from such fonts that are of interest to me. The issue seems to be rather convoluted, and for starters I wanted to check out what solutions might have been developed by others. I found a couple of macros by Klaus Linke that based on their descriptions could be useful. The macros are SymbolToUnicode and SymbolsUnprotect. The url for them: http://groups.google.com/group/microsoft.public.word.vba.general/browse_thread/thread/ffedfe9411830efc/741c6800843c8a3d?q=%22SymbolToUnicode+replaces+any+character%22 Unfortunately, neither of them works for me. The problem might be that when I copy / paste from the browser the macros code gets trashed due to incorrect browser codepage. So if anyone (Klaus?) who used them and found them working, could share the proper code with me either posting it here or e-mailing it to me, that would be appreciated. Pointers to any other pertinent information and code would also be appreciated. (I already read Finding and replacing symbols by Dave Rado.) Sergey
From: Chand on 6 Jan 2010 12:54 Hi There I got same problem while working with some unicode chars like ਿ ੁ ੱ ੰ. Try to search with use wildcard off and unicode charcode with ^uNNNN where n iin unicode value i.e. ^u2562; as follows Selection.Find.ClearFormatting With Selection.Find .text = "^u2562" .Replacement.text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With While Selection.Find.Execute Its working perfectly but sometimes needs ^? at before or after the unicode value to search combinations with any charater as ^? for any char; like "^?^u2562^u" or "^?^?^u2526" etc.
From: data.file on 6 Jan 2010 13:51 Hello Chand, > I got same problem while working with some unicode chars like ? ? ? ?. > Try > to search with use wildcard off and unicode charcode with ^uNNNN where n > iin > unicode value i.e. ^u2562; as follows Where do I get the unicode value? > Its working perfectly but sometimes needs ^? at before or after the > unicode > value to search combinations with any charater as ^? for any char; like > "^?^u2562^u" or "^?^?^u2526" etc. When you search for ^?^uNNNN you are actually searching for two characters. And as far as I understand, searching / replacing *unicode* characters is simple and straightforward (when you have the unicode number of the character). Also, when doing it programmatically the advice is to use ChrW(NNN), as in Selection.Find.ClearFormatting With Selection.Find .text = ChrW(2562) Sergey
From: data.file on 7 Jan 2010 08:10 Greetings to Stuttgart/Germany Hello Klaus, Thanks for your prompt and thorough reply. I received your separate e-mail with the code as well. Concerning the SymbolToUnicode macro, I did not know about selecting symbols before running the macro. That bit of information applied, the code I copied from the Google page works fine. And this macro can be useful in its own right. As mentioned before, I'd like to be able to produce my own custom macros. For decorative fonts I'd use the code provided by Dave Rado in his article "Finding and replacing symbols" (haven't tested it yet). For unicode fonts I'd use regular search / replace. In both cases, however, I'd need to have some information to start with. Font and Char number for non-unicode fonts and Char number for unicode fonts. At the moment I do not have a means to come up with that information easily. If you happen to have any suggestions (macros) for that, it would be great. After reading your comments and those by Dave Rado on the subject, things appear to start making at least some sense. Thanks for that. Sergey
From: Klaus Linke on 7 Jan 2010 09:52 > As mentioned before, I'd like to be able to produce my own custom macros. > For decorative fonts I'd use the code provided by Dave Rado in his article > "Finding and replacing symbols" (haven't tested it yet). For unicode fonts > I'd use regular search / replace. In both cases, however, I'd need to have > some information to start with. Font and Char number for non-unicode fonts > and Char number for unicode fonts. > > At the moment I do not have a means to come up with that information > easily. When you insert symbols from the "Insert > Symbol" dialog, what's inserted is what I call a "protected" symbol. If you select the symbol, Word will not show the real (decorative) font that is applied, but instead the default font for that text. That way, when the user applies a different font to all the text, the symbols don't change. If you choose the Symbol font (or another decorative font) from the font dropdown and then type something, the inserted symbols not inserted "protected", i.e. "unprotected". They are more easily dealt with. That's what the macro is for: It turns "protected" symbols into "unprotected" ones, so that their real font becomes accessible. The Char number is usually &HF000 plus the code of whatever key to type that symbol. Say the Greek "alpha", on the key "a" (with code &H0061), would be ChrW(&HF061). That's why you see ChrW(61472) = ChrW(&HF020) and ChrW(61695) = ChrW(&HF0FF) in the macros. From &HF000 to &HF020 there can't be symbols, because the codes from 0 to 20 are control characters. Regards, Klaus
|
Next
|
Last
Pages: 1 2 Prev: Copy html table to word not keeping settings Next: Cannot get a watermark to insert... |