word怎么批量添加拼音
发布网友
发布时间:2022-04-25 09:53
我来回答
共2个回答
热心网友
时间:2023-12-02 01:24
选中你要标注拼音的字段。然后右键。接下来看下图操作。
热心网友
时间:2023-12-02 01:24
用宏指令,批量添加拼音。
方法如下:
宏——查看宏——创建宏——设置个宏名称——把下面的代码拷贝进去,保存。
宏——查看宏——运行你创建的宏,ok。
Sub AddPinYin()
'Author:MissileCat Date:20140410 version:1.0.0
' Addpinyin 宏
'为一篇完整的word文字加上标音标注
Dim tintTreatingCount As Integer
Dim tstrCharA As String
Dim tlngCurPos As Long
Dim tintA As Integer
Selection.WholeStory
tstrText = Selection.Text
tintTextLength = Selection.Characters.Count
tintlinestart = 1
tintTreatingCount = 0
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToAbsolute, Count:=1
Selection.MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToAbsolute, Count:=1
For tintloopx = 1 To tintTextLength
tlngCurPos = Selection.MoveRight(unit:=wdCharacter, Count:=1, Extend:=wdExtend)
tstrCharA = Right(Selection.Text, 1)
If AscW(tstrCharA) < 255 And AscW(tstrCharA) > -255 Then
If tintTreatingCount > 0 Then
tintA = Len(Selection.Text)
SendKeys "{enter}", 2
Application.Run MacroName:="FormatPhoneticGuide"
Selection.MoveRight unit:=wdCharacter, Count:=tintA
tintTreatingCount = 0
End If
Else
tintTreatingCount = tintTreatingCount + 1
End If
Next
'为每个字都加上空格
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToAbsolute, Count:=1
'Selection.HomeKey unit:=wdStory
For tintloopx = 1 To tintTextLength
Selection.MoveRight unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Next
MsgBox "任务成功完成"
' .Range.PhoneticGuide Text:="lǐ", Alignment:= _
' wdPhoneticGuideAlignmentOneTwoOne, Raise:=15, FontSize:=8, FontName _
' :="宋体"
End Sub