From: Mike Faulkner on 1 Oct 2006 10:25 Helmut You have provided me with a very interesting approach. Many thanks. Regards Mike "Helmut Weber" wrote: > Hi Mike, > > very interesting. > > I think in theory, there is no fastest solution. > The crucial point in searching for different things, > when it comes to speed, > is the question, what thing to search for first? > > I'd try to set up a list of languages, > with the most common first. > Search for the first language in the list, > and, if found, delete the found text. > If there is text left, then continue... > > If you want to be sure, that there is no text in > Konkani > msoLanguageIDKonkani ' 1111 > you have to search for Konkani, > or to search for all other languages and check, > whether there is any text left. > > No way around it, IMHO. > > msoLanguageIDAfrikaans 1078 > msoLanguageIDAlbanian 1052 > msoLanguageIDAmharic 1118 > msoLanguageIDArabic 1025 > msoLanguageIDArabicAlgeria 5121 > msoLanguageIDArabicBahrain 15361 > msoLanguageIDArabicEgypt 3073 > msoLanguageIDArabicIraq 2049 > msoLanguageIDArabicJordan 11265 > msoLanguageIDArabicKuwait 13313 > msoLanguageIDArabicLebanon 12289 > msoLanguageIDArabicLibya 4097 > msoLanguageIDArabicMorocco 6145 > msoLanguageIDArabicOman 8193 > msoLanguageIDArabicQatar 16385 > msoLanguageIDArabicSyria 10241 > msoLanguageIDArabicTunisia 7169 > msoLanguageIDArabicUAE 14337 > msoLanguageIDArabicYemen 9217 > msoLanguageIDArmenian 1067 > msoLanguageIDAssamese 1101 > msoLanguageIDAzeriCyrillic 2092 > msoLanguageIDAzeriLatin 1068 > msoLanguageIDBasque 1069 > msoLanguageIDBelgianDutch 2067 > msoLanguageIDBelgianFrench 2060 > msoLanguageIDBengali 1093 > msoLanguageIDBrazilianPortuguese 1046 > msoLanguageIDBulgarian 1026 > msoLanguageIDBurmese 1109 > msoLanguageIDByelorussian 1059 > msoLanguageIDCatalan 1027 > msoLanguageIDCherokee 1116 > msoLanguageIDChineseHongKong 3076 > msoLanguageIDChineseMacao 5124 > msoLanguageIDChineseSingapore 4100 > msoLanguageIDCroatian 1050 > msoLanguageIDCzech 1029 > msoLanguageIDDanish 1030 > msoLanguageIDDutch 1043 > msoLanguageIDEnglishAUS 3081 > msoLanguageIDEnglishBelize 10249 > msoLanguageIDEnglishCanadian 4105 > msoLanguageIDEnglishCaribbean 9225 > msoLanguageIDEnglishIreland 6153 > msoLanguageIDEnglishJamaica 8201 > msoLanguageIDEnglishNewZealand 5129 > msoLanguageIDEnglishPhilippines 13321 > msoLanguageIDEnglishSouthAfrica 7177 > msoLanguageIDEnglishTrinidad 11273 > msoLanguageIDEnglishUK 2057 > msoLanguageIDEnglishUS 1033 > msoLanguageIDEnglishZimbabwe 12297 > msoLanguageIDEstonian 1061 > msoLanguageIDFaeroese 1080 > msoLanguageIDFarsi 1065 > msoLanguageIDFinnish 1035 > msoLanguageIDFrench 1036 > msoLanguageIDFrenchCameroon 11276 > msoLanguageIDFrenchCanadian 3084 > msoLanguageIDFrenchCotedIvoire 12300 > msoLanguageIDFrenchLuxembourg 5132 > msoLanguageIDFrenchMali 13324 > msoLanguageIDFrenchMonaco 6156 > msoLanguageIDFrenchReunion 8204 > msoLanguageIDFrenchSenegal 10252 > msoLanguageIDFrenchWestIndies 7180 > msoLanguageIDFrenchZaire 9228 > msoLanguageIDFrisianNetherlands 1122 > msoLanguageIDGaelicIreland 2108 > msoLanguageIDGaelicScotland 1084 > msoLanguageIDGalician 1110 > msoLanguageIDGeorgian 1079 > msoLanguageIDGerman 1031 > msoLanguageIDGermanAustria 3079 > msoLanguageIDGermanLiechtenstein 5127 > msoLanguageIDGermanLuxembourg 4103 > msoLanguageIDGreek 1032 > msoLanguageIDGujarati 1095 > msoLanguageIDHebrew 1037 > msoLanguageIDHindi 1081 > msoLanguageIDHungarian 1038 > msoLanguageIDIcelandic 1039 > msoLanguageIDIndonesian 1057 > msoLanguageIDInuktitut 1117 > msoLanguageIDItalian 1040 > msoLanguageIDJapanese 1041 > msoLanguageIDKannada 1099 > msoLanguageIDKashmiri 1120 > msoLanguageIDKazakh 1087 > msoLanguageIDKhmer 1107 > msoLanguageIDKirghiz 1088 > msoLanguageIDKonkani 1111 > msoLanguageIDKorean 1042 > msoLanguageIDLao 1108 > msoLanguageIDLatvian 1062 > msoLanguageIDLithuanian 1063 > msoLanguageIDMacedonian 1071 > msoLanguageIDMalayalam 1100 > msoLanguageIDMalayBruneiDarussalam 2110 > msoLanguageIDMalaysian 1086 > msoLanguageIDMaltese 1082 > msoLanguageIDManipuri 1112 > msoLanguageIDMarathi 1102 > msoLanguageIDMexicanSpanish 2058 > msoLanguageIDMixed -2 > msoLanguageIDMongolian 1104 > msoLanguageIDNepali 1121 > msoLanguageIDNone 0 > msoLanguageIDNoProofing 1024 > msoLanguageIDNorwegianBokmol 1044 > msoLanguageIDNorwegianNynorsk 2068 > msoLanguageIDOriya 1096 > msoLanguageIDOromo 1138 > msoLanguageIDPolish 1045 > msoLanguageIDPortuguese 2070 > msoLanguageIDPunjabi 1094 > msoLanguageIDRhaetoRomanic 1047 > msoLanguageIDRomanian 1048 > msoLanguageIDRomanianMoldova 2072 > msoLanguageIDRussian 1049 > msoLanguageIDRussianMoldova 2073 > msoLanguageIDSamiLappish 1083 > msoLanguageIDSanskrit 1103 > msoLanguageIDSerbianCyrillic 3098 > msoLanguageIDSerbianLatin 2074 > msoLanguageIDSesotho 1072 > msoLanguageIDSimplifiedChinese 2052 > msoLanguageIDSindhi 1113 > msoLanguageIDSlovak 1051 > msoLanguageIDSlovenian 1060 > msoLanguageIDSorbian 1070 > msoLanguageIDSpanish 1034 > msoLanguageIDSpanishArgentina 11274 > msoLanguageIDSpanishBolivia 16394 > msoLanguageIDSpanishChile 13322 > msoLanguageIDSpanishColombia 9226 > msoLanguageIDSpanishCostaRica 5130 > msoLanguageIDSpanishDominicanRepublic 7178 > msoLanguageIDSpanishEcuador 12298 > msoLanguageIDSpanishElSalvador 17418 > msoLanguageIDSpanishGuatemala 4106 > msoLanguageIDSpanishHonduras 18442 > msoLanguageIDSpanishModernSort 3082 > msoLanguageIDSpanishNicaragua 19466 > msoLanguageIDSpanishPanama 6154 > msoLanguageIDSpanishParaguay 15370 > msoLanguageIDSpanishPeru 10250 > msoLanguageIDSpanishPuertoRico 20490 > msoLanguageIDSpanishUruguay 14346 > msoLanguageIDSpanishVenezuela 8202 > msoLanguageIDSutu 1072 > msoLanguageIDSwahili 1089 > msoLanguageIDSwedish 1053 > msoLanguageIDSwedishFinland 2077 > msoLanguageIDSwissFrench 4108 > msoLanguageIDSwissGerman 2055 > msoLanguageIDSwissItalian 2064 > msoLanguageIDTajik 1064 > msoLanguageIDTamil 1097 > msoLanguageIDTatar 1092 > msoLanguageIDTelugu 1098 > msoLanguageIDThai 1054 > msoLanguageIDTibetan
From: Mike Faulkner on 1 Oct 2006 17:17 Tony Thank you for your code. What ever method is used every character will have to be tested for LanguageID. In which case I'll probably use my method. Many thanks for your time. Regards Mike "Tony Jollans" wrote: > > Rather than hard coding and guessing what languages might be present or what > might be the most common language and maybe missing new languages or ones > without defined constants, what about taking the information from the > document, one language at a time as it is found. Something like this ... > > Dim CurrentLanguage As Long > Dim CurrentPosition As Long > CurrentPosition = 1 > > Dim LanguagesInUse As Collection > Set LanguagesInUse = New Collection > > With ActiveDocument > Do While CurrentPosition < .Range.Characters.Count > CurrentLanguage = .Range.Characters(CurrentPosition).LanguageID > On Error Resume Next > LanguagesInUse.Add CurrentLanguage, CStr(CurrentLanguage) > If Err.Number = 457 Then > On Error GoTo 0 > If CurrentPosition <> .Range.Characters.Count Then > CurrentPosition = CurrentPosition + 1 > End If > Else > On Error GoTo 0 > With .Range.Find > .ClearFormatting > .LanguageID = CurrentLanguage > .Replacement.ClearFormatting > .Text = "*" > .Replacement.Text = "" > .Forward = True > .Wrap = wdFindContinue > .Format = True > .MatchCase = False > .MatchWholeWord = False > .MatchAllWordForms = False > .MatchSoundsLike = False > .MatchWildcards = True > .Execute Replace:=wdReplaceAll > End With > End If > Loop > > MsgBox LanguagesInUse.Count & " languages are used in this document" > .Undo LanguagesInUse.Count > > End With > > The text replacement (removal) leaves tables and maybe other structural, > rather than textual, components behind and getting the loop to end properly > proved a little tricky - I haven't done exhaustive testing and may have > missed something. I quite like the approach, though, as it ought to be > adaptable for other properties which can vary at individual character level > and which are difficult to work with, so may do some more work on it. > > I would be interested in how it performs in a real situation compared to > whatever else you've tried. > > -- > Enjoy, > Tony > > "Helmut Weber" <nbhymsjxdgcn(a)mailinator.com> wrote in message > news:nqvqh2hrehau66vl0nepagc6rrvpifs3pu(a)4ax.com... > > Hi Mike, > > > > very interesting. > > > > I think in theory, there is no fastest solution. > > The crucial point in searching for different things, > > when it comes to speed, > > is the question, what thing to search for first? > > > > I'd try to set up a list of languages, > > with the most common first. > > Search for the first language in the list, > > and, if found, delete the found text. > > If there is text left, then continue... > > > > If you want to be sure, that there is no text in > > Konkani > > msoLanguageIDKonkani ' 1111 > > you have to search for Konkani, > > or to search for all other languages and check, > > whether there is any text left. > > > > No way around it, IMHO. > > > > msoLanguageIDAfrikaans 1078 > > msoLanguageIDAlbanian 1052 > > msoLanguageIDAmharic 1118 > > msoLanguageIDArabic 1025 > > msoLanguageIDArabicAlgeria 5121 > > msoLanguageIDArabicBahrain 15361 > > msoLanguageIDArabicEgypt 3073 > > msoLanguageIDArabicIraq 2049 > > msoLanguageIDArabicJordan 11265 > > msoLanguageIDArabicKuwait 13313 > > msoLanguageIDArabicLebanon 12289 > > msoLanguageIDArabicLibya 4097 > > msoLanguageIDArabicMorocco 6145 > > msoLanguageIDArabicOman 8193 > > msoLanguageIDArabicQatar 16385 > > msoLanguageIDArabicSyria 10241 > > msoLanguageIDArabicTunisia 7169 > > msoLanguageIDArabicUAE 14337 > > msoLanguageIDArabicYemen 9217 > > msoLanguageIDArmenian 1067 > > msoLanguageIDAssamese 1101 > > msoLanguageIDAzeriCyrillic 2092 > > msoLanguageIDAzeriLatin 1068 > > msoLanguageIDBasque 1069 > > msoLanguageIDBelgianDutch 2067 > > msoLanguageIDBelgianFrench 2060 > > msoLanguageIDBengali 1093 > > msoLanguageIDBrazilianPortuguese 1046 > > msoLanguageIDBulgarian 1026 > > msoLanguageIDBurmese 1109 > > msoLanguageIDByelorussian 1059 > > msoLanguageIDCatalan 1027 > > msoLanguageIDCherokee 1116 > > msoLanguageIDChineseHongKong 3076 > > msoLanguageIDChineseMacao 5124 > > msoLanguageIDChineseSingapore 4100 > > msoLanguageIDCroatian 1050 > > msoLanguageIDCzech 1029 > > msoLanguageIDDanish 1030 > > msoLanguageIDDutch 1043 > > msoLanguageIDEnglishAUS 3081 > > msoLanguageIDEnglishBelize 10249 > > msoLanguageIDEnglishCanadian 4105 > > msoLanguageIDEnglishCaribbean 9225 > > msoLanguageIDEnglishIreland 6153 > > msoLanguageIDEnglishJamaica 8201 > > msoLanguageIDEnglishNewZealand 5129 > > msoLanguageIDEnglishPhilippines 13321 > > msoLanguageIDEnglishSouthAfrica 7177 > > msoLanguageIDEnglishTrinidad 11273 > > msoLanguageIDEnglishUK 2057 > > msoLanguageIDEnglishUS 1033 > > msoLanguageIDEnglishZimbabwe 12297 > > msoLanguageIDEstonian 1061 > > msoLanguageIDFaeroese 1080 > > msoLanguageIDFarsi 1065 > > msoLanguageIDFinnish 1035 > > msoLanguageIDFrench 1036 > > msoLanguageIDFrenchCameroon 11276 > > msoLanguageIDFrenchCanadian 3084 > > msoLanguageIDFrenchCotedIvoire 12300 > > msoLanguageIDFrenchLuxembourg 5132 > > msoLanguageIDFrenchMali 13324 > > msoLanguageIDFrenchMonaco 6156 > > msoLanguageIDFrenchReunion 8204 > > msoLanguageIDFrenchSenegal 10252 > > msoLanguageIDFrenchWestIndies 7180 > > msoLanguageIDFrenchZaire 9228 > > msoLanguageIDFrisianNetherlands 1122 > > msoLanguageIDGaelicIreland 2108 > > msoLanguageIDGaelicScotland 1084 > > msoLanguageIDGalician 1110 > > msoLanguageIDGeorgian 1079 > > msoLanguageIDGerman 1031 > > msoLanguageIDGermanAustria 3079 > > msoLanguageIDGermanLiechtenstein 5127 > > msoLanguageIDGermanLuxembourg 4103 > > msoLanguageIDGreek 1032 > > msoLanguageIDGujarati 1095 > > msoLanguageIDHebrew 1037 > > msoLanguageIDHindi 1081 > > mso
First
|
Prev
|
Pages: 1 2 Prev: <Buffer for return string is too small> Next: Add Watermark macro - Variable not defined |