首页 > 办公 > Excel > 正文

Excel简体繁体转换的VBA代码

2019-10-25 20:25:50
字体:
来源:转载
供稿:网友

   在Excel中,没有简体和繁体文字之间的转换功能。

  但是Word却有此功能,因此,我们可以在Excel中通过VBA代码调用Word的繁体和简体功能,实现在Excel中的简体繁体转换的功能。

  下面就是与此相关的VBA代码,希望对你有帮助。

  Sub JFZH()

  Dim wd As Word.Application

  Set wd = New Word.Application

  With wd.Documents.Add .Sections(1).Range.Text = Sheet1.Cells(1, 1).Text ' .Sections(1).Range.Select 'wd.WordBasic.ToolsSCTCTranslate Direction:=0, Varients:=0, TranslateCommon:=0

  wd.WordBasic.ToolsTCSCTranslate Direction:=0, Varients:=0, TranslateCommon:=0  '繁体转简体

  Sheet1.Cells(1, 1) = .Sections(1).Range.Text .Close False '简体转繁体

  End With wd.Quit

  Set wd = Nothing End Sub


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表