结合我另一篇文章,自己建立韵母库。填词用。
Function pinyin(p As String) As String
i = Asc(p)
Select Case i
Case -20319 To -20318: pinyin = "a "
Case -20317 To -20305: pinyin = "ai "
Case -20304 To -20296: pinyin = "an "
Case -20295 To -20293: pinyin = "ang "
Case -20292 To -20284: pinyin = "ao "
Case -20283 To -20266: pinyin = "a "
Case -20265 To -20258: pinyin = "ai "
Case -20257 To -20243: pinyin = "an "
Case -20242 To -20231: pinyin = "ang "
Case -20230 To -20052: pinyin = "ao "
Case -20051 To -20037: pinyin = "ei "
Case -20036 To -20033: pinyin = "en "
Case -20032 To -20027: pinyin = "eng "
Case -20026 To -20003: pinyin = "i "
Case -20002 To -19991: pinyin = "ian "
Case -19990 To -19987: pinyin = "iao "
Case -19986 To -19983: pinyin = "ie "
Case -19982 To -19977: pinyin = "in "
Case -19976 To -19806: pinyin = "ing "
Case -19805 To -19785: pinyin = "o "
Case -19784 To -19776: pinyin = "u "
Case -19775 To -19775: pinyin = "a "
Case -19774 To -19764: pinyin = "ai "
Case -19763 To -19757: pinyin = "an "
Case -19756 To -19752: pinyin = "ang "
Case -19751 To -19747: pinyin = "ao "
Case -19746 To -19742: pinyin = "e "
Case -19741 To -19740: pinyin = "eng "
Case -19739 To -19729: pinyin = "a "
Case -19728 To -19726: pinyin = "ai "
Case -19725 To -19716: pinyin = "an "
Case -19715 To -19541: pinyin = "ang "
Case -19540 To -19532: pinyin = "ao "
Case -19531 To -19526: pinyin = "e "
Case -19525 To -19516: pinyin = "en "
Case -19515 To -19501: pinyin = "eng "
Case -19500 To -19485: pinyin = "-i "
Case -19484 To -19480: pinyin = "ong "
Case -19479 To -19468: pinyin = "ou "
Case -19467 To -19290: pinyin = "u "
Case -19289 To -19289: pinyin = "uai "
Case -19288 To -19282: pinyin = "uan "
Case -19281 To -19276: pinyin = "uang "
Case -19275 To -19271: pinyin = "ui "
Case -19270 To -19264: pinyin = "un "
Case -19263 To -19262: pinyin = "uo "
Case -19261 To -19250: pinyin = "-i "
Case -19249 To -19244: pinyin = "ong "
Case -19243 To -19243: pinyin = "ou "
Case -19242 To -19239: pinyin = "u "
Case -19238 To -19236: pinyin = "uan "
Case -19235 To -19228: pinyin = "ui "
Case -19227 To -19225: pinyin = "un "
Case -19224 To -19219: pinyin = "uo "
Case -19218 To -19213: pinyin = "a "
Case -19212 To -19039: pinyin = "ai "
Case -19038 To -19024: pinyin = "an "
Case -19023 To -19019: pinyin = "ang "
Case -19018 To -19007: pinyin = "ao "
Case -19006 To -19004: pinyin = "e "
Case -19003 To -18997: pinyin = "eng "
Case -18996 To -18978: pinyin = "i "
Case -18977 To -18962: pinyin = "ian "
Case -18961 To -18953: pinyin = "iao "
Case -18952 To -18784: pinyin = "ie "
Case -18783 To -18775: pinyin = "ing "
Case -18774 To -18774: pinyin = "iu "
Case -18773 To -18527: pinyin = "ong "
Case -18526 To -18519: pinyin = "a "
Case -18518 To -18502: pinyin = "an "
Case -18501 To -18491: pinyin = "ang "
Case -18490 To -18479: pinyin = "ei "
Case -18478 To -18464: pinyin = "en "
Case -18463 To -18449: pinyin = "eng "
Case -18448 To -18448: pinyin = "o "
Case -18447 To -18447: pinyin = "ou "
Case -18446 To -18240: pinyin = "u "
Case -18239 To -18238: pinyin = "a "
Case -18237 To -18232: pinyin = "ai "
Case -18231 To -18221: pinyin = "an "
Case -18220 To -18212: pinyin = "ang "
Case -18211 To -18202: pinyin = "ao "
Case -18201 To -18185: pinyin = "e "
Case -18184 To -18184: pinyin = "ei "
Case -18183 To -18182: pinyin = "en "
Case -18181 To -18013: pinyin = "eng "
Case -18012 To -17998: pinyin = "ong "
Case -17997 To -17989: pinyin = "ou "
Case -17988 To -17971: pinyin = "u "
Case -17970 To -17965: pinyin = "ua "
Case -17964 To -17962: pinyin = "uai "
Case -17961 To -17951: pinyin = "uan "
Case -17950 To -17948: pinyin = "uang "
Case -17947 To -17932: pinyin = "ui "
Case -17931 To -17929: pinyin = "un "
Case -17928 To -17923: pinyin = "uo "
Case -17922 To -17760: pinyin = "a "
Case -17759 To -17753: pinyin = "ai "
Case -17752 To -17734: pinyin = "an "
Case -17733 To -17731: pinyin = "ang "
Case -17730 To -17722: pinyin = "ao "
Case -17721 To -17704: pinyin = "e "
Case -17703 To -17702: pinyin = "ei "
Case -17701 To -17698: pinyin = "en "
Case -17697 To -17693: pinyin = "eng "
Case -17692 To -17684: pinyin = "ong "
Case -17683 To -17677: pinyin = "ou "
Case -17676 To -17497: pinyin = "u "
Case -17496 To -17488: pinyin = "ua "
Case -17487 To -17483: pinyin = "uai "
Case -17482 To -17469: pinyin = "uan "
Case -17468 To -17455: pinyin = "uang "
Case -17454 To -17434: pinyin = "ui "
Case -17433 To -17428: pinyin = "un "
Case -17427 To -17418: pinyin = "uo "
Case -17417 To -17203: pinyin = "i "
Case -17202 To -17186: pinyin = "ia "
Case -17185 To -16984: pinyin = "ian "
Case -16983 To -16971: pinyin = "iang "
Case -16970 To -16943: pinyin = "iao "
Case -16942 To -16916: pinyin = "ie "
Case -16915 To -16734: pinyin = "in "
Case -16733 To -16709: pinyin = "ing "
Case -16708 To -16707: pinyin = "iong "
Case -16706 To -16690: pinyin = "iu "
Case -16689 To -16665: pinyin = "v "
Case -16664 To -16658: pinyin = "uan "
Case -16657 To -16648: pinyin = "ue "
Case -16647 To -16475: pinyin = "un "
Case -16474 To -16471: pinyin = "a "
Case -16470 To -16466: pinyin = "ai "
Case -16465 To -16460: pinyin = "an "
Case -16459 To -16453: pinyin = "ang "
Case -16452 To -16449: pinyin = "ao "
Case -16448 To -16434: pinyin = "e "
Case -16433 To -16430: pinyin = "en "
Case -16429 To -16428: pinyin = "eng "
Case -16427 To -16424: pinyin = "ong "
Case -16423 To -16420: pinyin = "ou "
Case -16419 To -16413: pinyin = "u "
Case -16412 To -16408: pinyin = "ua "
Case -16407 To -16404: pinyin = "uai "
Case -16403 To -16402: pinyin = "uan "
Case -16401 To -16394: pinyin = "uang "
Case -16393 To -16221: pinyin = "ui "
Case -16220 To -16217: pinyin = "un "
Case -16216 To -16213: pinyin = "uo "
Case -16212 To -16206: pinyin = "a "
Case -16205 To -16203: pinyin = "ai "
Case -16202 To -16188: pinyin = "an "
Case -16187 To -16181: pinyin = "ang "
Case -16180 To -16172: pinyin = "ao "
Case -16171 To -16170: pinyin = "e "
Case -16169 To -16159: pinyin = "ei "
Case -16158 To -16156: pinyin = "eng "
Case -16155 To -15960: pinyin = "i "
Case -15959 To -15959: pinyin = "ia "
Case -15958 To -15945: pinyin = "ian "
Case -15944 To -15934: pinyin = "iang "
Case -15933 To -15921: pinyin = "iao "
Case -15920 To -15916: pinyin = "ie "
Case -15915 To -15904: pinyin = "in "
Case -15903 To -15890: pinyin = "ing "
Case -15889 To -15879: pinyin = "iu "
Case -15878 To -15708: pinyin = "ong "
Case -15707 To -15702: pinyin = "ou "
Case -15701 To -15682: pinyin = "u "
Case -15681 To -15668: pinyin = "v "
Case -15667 To -15662: pinyin = "uan "
Case -15661 To -15660: pinyin = "ue "
Case -15659 To -15653: pinyin = "un "
Case -15652 To -15641: pinyin = "uo "
Case -15640 To -15632: pinyin = "a "
Case -15631 To -15626: pinyin = "ai "
Case -15625 To -15455: pinyin = "an "
Case -15454 To -15449: pinyin = "ang "
Case -15448 To -15437: pinyin = "ao "
Case -15436 To -15436: pinyin = "e "
Case -15435 To -15420: pinyin = "ei "
Case -15419 To -15417: pinyin = "en "
Case -15416 To -15409: pinyin = "eng "
Case -15408 To -15395: pinyin = "i "
Case -15394 To -15386: pinyin = "ian "
Case -15385 To -15378: pinyin = "iao "
Case -15377 To -15376: pinyin = "ie "
Case -15375 To -15370: pinyin = "in "
Case -15369 To -15364: pinyin = "ing "
Case -15363 To -15363: pinyin = "iu "
Case -15362 To -15184: pinyin = "o "
Case -15183 To -15181: pinyin = "ou "
Case -15180 To -15166: pinyin = "u "
Case -15165 To -15159: pinyin = "a "
Case -15158 To -15154: pinyin = "ai "
Case -15153 To -15151: pinyin = "an "
Case -15150 To -15150: pinyin = "ang "
Case -15149 To -15145: pinyin = "ao "
Case -15144 To -15144: pinyin = "e "
Case -15143 To -15142: pinyin = "ei "
Case -15141 To -15141: pinyin = "en "
Case -15140 To -15140: pinyin = "eng "
Case -15139 To -15129: pinyin = "i "
Case -15128 To -15122: pinyin = "ian "
Case -15121 To -15120: pinyin = "iang "
Case -15119 To -15118: pinyin = "iao "
Case -15117 To -15111: pinyin = "ie "
Case -15110 To -15110: pinyin = "in "
Case -15109 To -14942: pinyin = "ing "
Case -14941 To -14938: pinyin = "iu "
Case -14937 To -14934: pinyin = "ong "
Case -14933 To -14931: pinyin = "u "
Case -14930 To -14930: pinyin = "v "
Case -14929 To -14929: pinyin = "uan "
Case -14928 To -14927: pinyin = "ue "
Case -14926 To -14923: pinyin = "uo "
Case -14922 To -14922: pinyin = "o "
Case -14921 To -14915: pinyin = "ou "
Case -14914 To -14909: pinyin = "a "
Case -14908 To -14903: pinyin = "ai "
Case -14902 To -14895: pinyin = "an "
Case -14894 To -14890: pinyin = "ang "
Case -14889 To -14883: pinyin = "ao "
Case -14882 To -14874: pinyin = "ei "
Case -14873 To -14872: pinyin = "en "
Case -14871 To -14858: pinyin = "eng "
Case -14857 To -14679: pinyin = "i "
Case -14678 To -14675: pinyin = "ian "
Case -14674 To -14671: pinyin = "iao "
Case -14670 To -14669: pinyin = "ie "
Case -14668 To -14664: pinyin = "in "
Case -14663 To -14655: pinyin = "ing "
Case -14654 To -14646: pinyin = "o "
Case -14645 To -14631: pinyin = "u "
Case -14630 To -14595: pinyin = "i "
Case -14594 To -14430: pinyin = "ia "
Case -14429 To -14408: pinyin = "ian "
Case -14407 To -14400: pinyin = "iang "
Case -14399 To -14385: pinyin = "iao "
Case -14384 To -14380: pinyin = "ie "
Case -14379 To -14369: pinyin = "in "
Case -14368 To -14356: pinyin = "ing "
Case -14355 To -14354: pinyin = "iong "
Case -14353 To -14346: pinyin = "iu "
Case -14345 To -14171: pinyin = "v "
Case -14170 To -14160: pinyin = "uan "
Case -14159 To -14152: pinyin = "ue "
Case -14151 To -14150: pinyin = "un "
Case -14149 To -14146: pinyin = "an "
Case -14145 To -14141: pinyin = "ang "
Case -14140 To -14138: pinyin = "ao "
Case -14137 To -14136: pinyin = "e "
Case -14135 To -14126: pinyin = "en "
Case -14125 To -14124: pinyin = "eng "
Case -14123 To -14123: pinyin = "-i "
Case -14122 To -14113: pinyin = "ong "
Case -14112 To -14110: pinyin = "ou "
Case -14109 To -14100: pinyin = "u "
Case -14099 To -14098: pinyin = "uan "
Case -14097 To -14095: pinyin = "ui "
Case -14094 To -14093: pinyin = "un "
Case -14092 To -14091: pinyin = "uo "
Case -14090 To -14088: pinyin = "a "
Case -14087 To -14084: pinyin = "ai "
Case -14083 To -13918: pinyin = "an "
Case -13917 To -13915: pinyin = "ang "
Case -13914 To -13911: pinyin = "ao "
Case -13910 To -13908: pinyin = "e "
Case -13907 To -13907: pinyin = "en "
Case -13906 To -13906: pinyin = "eng "
Case -13905 To -13897: pinyin = "a "
Case -13896 To -13895: pinyin = "ai "
Case -13894 To -13879: pinyin = "an "
Case -13878 To -13871: pinyin = "ang "
Case -13870 To -13860: pinyin = "ao "
Case -13859 To -13848: pinyin = "e "
Case -13847 To -13832: pinyin = "en "
Case -13831 To -13659: pinyin = "eng "
Case -13658 To -13612: pinyin = "-i "
Case -13611 To -13602: pinyin = "ou "
Case -13601 To -13407: pinyin = "u "
Case -13406 To -13405: pinyin = "ua "
Case -13404 To -13401: pinyin = "uai "
Case -13400 To -13399: pinyin = "uan "
Case -13398 To -13396: pinyin = "uang "
Case -13395 To -13392: pinyin = "ui "
Case -13391 To -13388: pinyin = "un "
Case -13387 To -13384: pinyin = "uo "
Case -13383 To -13368: pinyin ="-i "
Case -13367 To -13360: pinyin = "ong "
Case -13359 To -13357: pinyin = "ou "
Case -13356 To -13344: pinyin = "u "
Case -13343 To -13341: pinyin = "uan "
Case -13340 To -13330: pinyin = "ui "
Case -13329 To -13327: pinyin = "un "
Case -13326 To -13319: pinyin = "uo "
Case -13318 To -13148: pinyin = "a "
Case -13147 To -13139: pinyin = "ai "
Case -13138 To -13121: pinyin = "an "
Case -13120 To -13108: pinyin = "ang "
Case -13107 To -13097: pinyin = "ao "
Case -13096 To -13096: pinyin = "e "
Case -13095 To -13092: pinyin = "eng "
Case -13091 To -13077: pinyin = "i "
Case -13076 To -13069: pinyin = "ian "
Case -13068 To -13064: pinyin = "iao "
Case -13063 To -13061: pinyin = "ie "
Case -13060 To -12889: pinyin = "ing "
Case -12888 To -12876: pinyin = "ong "
Case -12875 To -12872: pinyin = "ou "
Case -12871 To -12861: pinyin = "u "
Case -12860 To -12859: pinyin = "uan "
Case -12858 To -12853: pinyin = "ui "
Case -12852 To -12850: pinyin = "un "
Case -12849 To -12839: pinyin = "uo "
Case -12838 To -12832: pinyin = "a "
Case -12831 To -12830: pinyin = "ai "
Case -12829 To -12813: pinyin = "an "
Case -12812 To -12803: pinyin = "ang "
Case -12802 To -12608: pinyin = "ei "
Case -12607 To -12598: pinyin = "en "
Case -12597 To -12595: pinyin = "eng "
Case -12594 To -12586: pinyin = "o "
Case -12585 To -12557: pinyin = "u "
Case -12556 To -12360: pinyin = "i "
Case -12359 To -12347: pinyin = "ia "
Case -12346 To -12321: pinyin = "ian "
Case -12320 To -12301: pinyin = "iang "
Case -12300 To -12121: pinyin = "iao "
Case -12120 To -12100: pinyin = "ie "
Case -12099 To -12090: pinyin = "in "
Case -12089 To -12075: pinyin = "ing "
Case -12074 To -12068: pinyin = "iong "
Case -12067 To -12059: pinyin = "iu "
Case -12058 To -12040: pinyin = "v "
Case -12039 To -11868: pinyin = "uan "
Case -11867 To -11862: pinyin = "ue "
Case -11861 To -11848: pinyin = "un "
Case -11847 To -11832: pinyin = "a "
Case -11831 To -11799: pinyin = "an "
Case -11798 To -11782: pinyin = "ang "
Case -11781 To -11605: pinyin = "ao "
Case -11604 To -11590: pinyin = "e "
Case -11589 To -11537: pinyin = "i "
Case -11536 To -11359: pinyin = "in "
Case -11358 To -11341: pinyin = "ing "
Case -11340 To -11340: pinyin = "o "
Case -11339 To -11325: pinyin = "ong "
Case -11324 To -11304: pinyin = "ou "
Case -11303 To -11098: pinyin = "v "
Case -11097 To -11078: pinyin = "uan "
Case -11077 To -11068: pinyin = "ue "
Case -11067 To -11056: pinyin = "un "
Case -11055 To -11053: pinyin = "a "
Case -11052 To -11046: pinyin = "ai "
Case -11045 To -11042: pinyin = "an "
Case -11041 To -11039: pinyin = "ang "
Case -11038 To -11025: pinyin = "ao "
Case -11024 To -11021: pinyin = "e "
Case -11020 To -11020: pinyin = "ei "
Case -11019 To -11019: pinyin = "en "
Case -11018 To -11015: pinyin = "eng "
Case -11014 To -10839: pinyin = "a "
Case -10838 To -10833: pinyin = "ai "
Case -10832 To -10816: pinyin = "an "
Case -10815 To -10801: pinyin = "ang "
Case -10800 To -10791: pinyin = "ao "
Case -10790 To -10781: pinyin = "e "
Case -10780 To -10765: pinyin = "en "
Case -10764 To -10588: pinyin = "eng "
Case -10587 To -10545: pinyin = "-i "
Case -10544 To -10534: pinyin = "ong "
Case -10533 To -10520: pinyin = "ou "
Case -10519 To -10332: pinyin = "u "
Case -10331 To -10330: pinyin = "ua "
Case -10329 To -10329: pinyin = "uai "
Case -10328 To -10323: pinyin = "uan "
Case -10322 To -10316: pinyin = "uang "
Case -10315 To -10310: pinyin = "ui "
Case -10309 To -10308: pinyin = "un "
Case -10307 To -10297: pinyin = "uo "
Case -10296 To -10282: pinyin = "-i "
Case -10281 To -10275: pinyin = "ong "
Case -10274 To -10271: pinyin = "ou "
Case -10270 To -10263: pinyin = "u "
Case -10262 To -10261: pinyin = "uan "
Case -10260 To -10257: pinyin = "ui "
Case -10256 To -10255: pinyin = "un "
Case -10254 To -10254: pinyin = "uo "
Case Else: pinyin = p
End Select
End Function
Function getym(str)
For i = 1 To Len(str)
getym = getym & pinyin(Mid(str, i, 1))
Next i
End Function