Macros in MS Word and Cyrillic Thread poster: Madeleine MacRae Klintebo
|
Sofware: Word 2003 on one computer/Word 2000 on the other I'm trying to help a Russian colleague. We both regularly have to send out emails using a mail program (Maxemail). This is no problem when the receipient has a "proper" email address. However, when they use a web based service, such as gmail, hotmail, yahoo, etc., character recognition is a major problem. All these services seem to have their own rules about how they deal with non ISO-8859-1 characters. <... See more Sofware: Word 2003 on one computer/Word 2000 on the other I'm trying to help a Russian colleague. We both regularly have to send out emails using a mail program (Maxemail). This is no problem when the receipient has a "proper" email address. However, when they use a web based service, such as gmail, hotmail, yahoo, etc., character recognition is a major problem. All these services seem to have their own rules about how they deal with non ISO-8859-1 characters. Although this character set should be able to handle Swedish, I often have to use Find & Replace All to replace characters with their html code (xxx). Not a big problem when writing in Swedish - 2 x 3 F&Rs (upper and lower case). My Russian colleague, however, has to do 2 x 35 F&Rs everytime she needs to send one of these emails. So I thought I'd try to help her with a macro (please note: I've never learnt Word VBA, only a bit of Excel VBA). Using VBA help, I managed to get the following code together: Sub Macro1() With Selection.Find .ClearFormatting .Text = "X" .Replacement.ClearFormatting .Replacement.Text = "А" .MatchCase = True .Execute Replace:=wdReplaceAll, Forward:=True, _ Wrap:=wdFindContinue End With End Sub This actually works, but to replace Cyrillic characters I have to be able to replace the X above with a Cyrillic character. I tried copying Russian characters from a web page, from Word doc, from Notepad, etc. But everytime I try to paste into the macro the character changes into a question mark. OK I though, maybe I have to type the character directly into the macro, so I sent it over to my colleagues computer which is set up for Russian and with a Russian keyboard. No luck, whenever she typed a Russian character it would appear as an unusual, non-Latin and non-Cyrillic, character. Would be very grateful for advice from Cyrillic writing colleagues and/or macro experts of any kind. Thank you in advance. ▲ Collapse | | | Uldis Liepkalns Latvia Local time: 23:13 Member (2003) English to Latvian + ...
do you speak about text in the e-mail text field or attachments? If the first, I'm afraid no solution there (I could list at least 10 causes causing corrupted diacritical characters' problem, none of them solvable on your or mine computer, these are settings on your provider's server, some servers your e-mail are passing through may have only 7 bit encoding available, not all e-mail programs support non-English characters- my Eudora doesn't- or more precisely, it has no option of switching the e... See more do you speak about text in the e-mail text field or attachments? If the first, I'm afraid no solution there (I could list at least 10 causes causing corrupted diacritical characters' problem, none of them solvable on your or mine computer, these are settings on your provider's server, some servers your e-mail are passing through may have only 7 bit encoding available, not all e-mail programs support non-English characters- my Eudora doesn't- or more precisely, it has no option of switching the encoding, etc., etc.). If you mean attachments getting corrupted, try to send them zipped, that solves it. Uldis ▲ Collapse | | | Encoding isn't the problem now | Jun 26, 2007 |
Or rather it was, but we've, sort of, solved that by using the html code for each character rather than the actual Cyrillic character. (Text has to be in email body, attachment isn't really an option using our mail sending program). Uldis Liepkalns wrote: do you speak about text in the e-mail text field or attachments? If the first, I'm afraid no solution there (I could list at least 10 causes causing corrupted diacritical characters' problem, none of them solvable on your or mine computer, these are settings on your provider's server, some servers your e-mail are passing through may have only 7 bit encoding available, not all e-mail programs support non-English characters- my Eudora doesn't- or more precisely, it has no option of switching the encoding, etc., etc.). If you mean attachments getting corrupted, try to send them zipped, that solves it. Uldis How true. I seem to have become an encoding expert of late, I also have Chinese colleagues (not to mention various European languages). And I'm their "character expert"!!! Now that we I know that using html code will, almost, solve the problem, my new problem is the macro. How can I write a macro in Word to save my colleague from having to do 70 Find & Replace each time she writes an email. As I mentioned before, I've worked out the macro I need to use. What I need to know now is how to insert Cyrillic characters into that macro. Neither copying nor typing the characters directly into the macro seems to work. Does MS Word's VBA not recognise Cyrillic characters?
[Edited at 2007-06-26 21:34] | | | Almir Comor MITI Bosnia and Herzegovina Local time: 22:13 Member (2004) English to Croatian + ... This might help | Jun 26, 2007 |
See this page, where you have the codes for Russian cyrillic characters: http://www.microsoft.com/globaldev/keyboards/kbdru.htm Hover over the keys and you'll see the codes. You need the numbers only, e.g. 0441 for "c". In the macro, the "0441" standing for "c" should look like this: Selection.Find.ClearFormatting Selecti... See more See this page, where you have the codes for Russian cyrillic characters: http://www.microsoft.com/globaldev/keyboards/kbdru.htm Hover over the keys and you'll see the codes. You need the numbers only, e.g. 0441 for "c". In the macro, the "0441" standing for "c" should look like this: Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ChrW(0441) .Replacement.Text = "s" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll The important bit is ChrW(0441). This is how you tell Visual Basic you actually want it to recognize cyrillic characters. At least that's how I managed to make macros to convert between Serbian Cyrillic and Latin alphabets. Hope this makes sense. Cheers
[Edited at 2007-06-26 23:08] ▲ Collapse | |
|
|
Thank you Almir | Jun 27, 2007 |
This page was very useful. Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ChrW(0441) .Replacement.Text = "s" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll
This is possibly the solution, only I haven't had time to get it to work today. Whenever I tried to enter the 4-figure code, the VBA editor would remove the 0 as soon as I moved to a different line (??). And when I ran the code nothing happened. When I have more time later this week, I'll try again and let everybody know if I find a working solution. Thanks again Almir. | | | To report site rules violations or get help, contact a site moderator: You can also contact site staff by submitting a support request » Macros in MS Word and Cyrillic Protemos translation business management system | Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!
The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.
More info » |
| Trados Business Manager Lite | Create customer quotes and invoices from within Trados Studio
Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.
More info » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |