卡饭网 > excel > 正文

Excel简体繁体转换的VBA代码

来源:本站整理 作者:梦在深巷 时间:2013-05-09 02:56:51

在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

相关推荐