资源描述:
《繁体字转简体字代码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Private Declare PtrSafe Function LCMapString Lib "kernel32" Alias "LCMapStringA" (ByVal Locale As Long, ByVal dwMapFlags As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, ByVal lpDestStr As String, ByVal cchDest As Long) As LongPrivate Declare Pt
2、rSafe Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As LongDim STf As String '繁体字符串Dim STj As String ' 简体字符串Dim STlen As Long ' 待转换字串长度Sub 简体转繁体() 'Gb码简体转繁体On Error Resume NextDim 被转换区域 As RangeSet 被转换区域 = Appli
3、cation.InputBox("请选取要转换繁体的区域", "替换提示", , , , , , 8)arr = 被转换区域.Value For x = 1 To UBound(arr) STj = arr(x, 1) STlen = lstrlen(STj) STf = Space(STlen) LCMapString &H804, &H4000000, STj, STlen, STf, STlen arr(x, 1) =
4、STf Next x被转换区域 = arrEnd SubSub 繁体转简体() 'Gb码繁体转简体On Error Resume NextDim 被转换区域 As RangeSet 被转换区域 = Application.InputBox("请选取要转换简体的区域", "替换提示", , , , , , 8)arr = 被转换区域.Value For x = 1 To UBound(arr) STf = arr(x, 1) STlen = lstrlen(
5、STf) STj = Space(STlen) LCMapString &H804, &H2000000, STf, STlen, STj, STlen arr(x, 1) = STj Next x被转换区域 = arrEnd Sub