资源描述:
《exel表格汉字转换成拼音的方法》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Excel中把汉字变成拼音的方法:例图:1.启动Excel2003(其它版本请仿照操作),打开相应的工作表;2.执行“工具(开发工具)→宏→VisualBasic编辑器”命令(或者直接按“Alt+F11”组合键),进入VisualBasic编辑状态;3.执行“插入→模块”命令,插入一个新模块。再双击插入的模块,进入模块代码编辑状态;4.将代码输入其中;5.代码输入完成后,关闭VisualBasic编辑窗口,返回Excel编辑状态;6.自定义函数就可以用了,如:选中A2单元格,输入公式:=PinYin(A1),即可出现拼音样式。PS、以office2007版本为例,若找不到“开发工
2、具选项”,则在按钮中找到“excel选项”-“常用”-“再功能区显示开发工具选项卡”-确定。另外,宏的设置,也是在该按钮中找到“excel选项”-“信任中心”-“信任中心设置”-“宏设置”-“启用所有宏”-确定。这样就没问题了。代码如下。FunctionPinYin(HzAsString)DimPinMaAsStringDimMyPinMaAsVariantDimTempAsInteger,iAsInteger,jAsIntegerPinMa="a,20319,ai,20317,an,20304,ang,20295,ao,20292,"PinMa=PinMa&"ba,20283,
3、bai,20265,ban,20257,bang,20242,bao,20230,bei,20051,ben,20036,beng,20032,bi,20026,bian,20002,biao,19990,bie,19986,bin,19982,bing,19976,bo,19805,bu,19784,"PinMa=PinMa&"ca,19775,cai,19774,can,19763,cang,19756,cao,19751,ce,19746,ceng,19741,cha,19739,chai,19728,chan,19725,chang,19715,chao,19540,ch
4、e,19531,chen,19525,cheng,19515,chi,19500,chong,19484,chou,19479,chu,19467,chuai,19289,chuan,19288,chuang,19281,chui,19275,chun,19270,chuo,19263,ci,19261,cong,19249,cou,19243,cu,19242,cuan,19238,cui,19235,cun,19227,cuo,19224,"PinMa=PinMa&"da,19218,dai,19212,dan,19038,dang,19023,dao,19018,de,19
5、006,deng,19003,di,18996,dian,18977,diao,18961,die,18952,ding,18783,diu,18774,dong,18773,dou,18763,du,18756,duan,18741,dui,18735,dun,18731,duo,18722,"PinMa=PinMa&"e,18710,en,18697,er,18696,"PinMa=PinMa&"fa,18526,fan,18518,fang,18501,fei,18490,fen,18478,feng,18463,fo,18448,fou,18447,fu,18446,"P
6、inMa=PinMa&"ga,18239,gai,18237,gan,18231,gang,18220,gao,18211,ge,18201,gei,18184,gen,18183,geng,18181,gong,18012,gou,17997,gu,17988,gua,17970,guai,17964,guan,17961,guang,17950,gui,17947,gun,17931,guo,17928,"PinMa=PinMa&"ha,17922,hai,17759,han,17752,hang,17733,hao,17730,he,17721,hei,17703,hen,
7、17701,heng,17697,hong,17692,hou,17683,hu,17676,hua,17496,huai,17487,huan,17482,huang,17468,hui,17454,hun,17433,huo,17427,"PinMa=PinMa&"ji,17417,jia,17202,jian,17185,jiang,16983,jiao,16970,jie,16942,jin,16915,jing,16733,jiong,16708,jiu,16706,j