我查看了此链接How to add phonetic guides to all the texts at once?,但它没有回答我的问题。
我在Mac上使用MS Word 2016。我仔细阅读了上面所写的内容,但无法弄清楚如何做我想做的事。
我经常使用语音指南,只使用我不知道的几个字符。我想为它创建一个宏,所以我 1)不必突出每个角色(虽然不是最大的问题), 2)不必点击拼音指南图标(虽然不是最大的问题), 3)不必手动更改字体(我喜欢Arial Unicode MS), 4)不必手动将对齐更改为居中。
我曾尝试录制一些宏,但起初宏只会转到我创建宏的特定字符,它不允许我突出显示另一个字符,光标只是跳回到原始字符。
例如,在我们特权中,如果我转换了我,然后去了他们并运行宏,光标会跳回我。
我试着删除了 .Start = 2280 .End = 2281 从处理特定字符的宏开始,但宏记录了原始字符中的“特定”拼音Ruby文本,因此当我在“不同”的汉字上运行宏时,它会将相同的拼音Ruby文本放在另一个上面字符。
例如,我在初始时记录了宏并获得了chū。
然后我在我身上录制了宏,并且还得到了chū。
你对宏有多了解这项工作吗?
感谢您提供任何帮助。
苏格兰人 PS,这是我创建的三个宏。
Sub convert_to_Pinyin()
'
' convert_to_Pinyin Macro
'
'
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection
.Start = 2280
.End = 2281
.Range.PhoneticGuide Text:="ch" & ChrW(363), Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
End Sub
Sub convert_to_Pinyin_R1()
'
' convert_to_Pinyin_R1 Macro
'
'
With Selection
.Start = 2372
.End = 2373
.Range.PhoneticGuide Text:="xí", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2371
.End = 2372
.Range.PhoneticGuide Text:="zuò", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2369
.End = 2371
.Range.PhoneticGuide Text:="tóng", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2369
.End = 2369
.Range.PhoneticGuide Text:="yì", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2368
.End = 2369
.Range.PhoneticGuide Text:="t" & ChrW(257), Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2367
.End = 2368
.Range.PhoneticGuide Text:="y" & ChrW(468), Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2366
.End = 2367
.Range.PhoneticGuide Text:="néng", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2364
.End = 2366
.Range.PhoneticGuide Text:="quán", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2364
.End = 2364
.Range.PhoneticGuide Text:="tè", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2362
.End = 2364
.Range.PhoneticGuide Text:="men", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2362
.End = 2362
.Range.PhoneticGuide Text:="w" & ChrW(466), Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2361
.End = 2362
.Range.PhoneticGuide Text:="g" & ChrW(283) & "i", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2360
.End = 2361
.Range.PhoneticGuide Text:="cì", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
With Selection
.Start = 2359
.End = 2360
.Range.PhoneticGuide Text:="shén", Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
End Sub
Sub convert_to_Pinyin_R2()
'
' convert_to_Pinyin Macro
'
'
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection
.Range.PhoneticGuide Text:="ch" & ChrW(363), Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
End With
End Sub
答案 0 :(得分:0)
你的宏是一个好的开始。诀窍是移动焦点。
以下内容从您的选择开始 - 在我的测试中,我复制并粘贴了您向我们展示的内容并选择了这四个字符。
选择分配给Range
,您可以将其视为选择,但代码中可能有很多选项(虽然只有一个选项),但用户不会选择看他们。这意味着屏幕也没有跳过"当焦点发生变化时。
由于代码应自动移动字符("循环"),然后接下来获取总字符数,然后设置循环。请注意,循环向后。这是因为Word EQ字段替换了字符,这与销毁原始字段和放入新字段相同。所以它只能倒退。
然后InputBox
会向您请求语音文字。最后,使用您的输入执行您录制的代码。
Sub PhoneticGuide()
Dim r As word.Range, c As word.Range
Dim s As String, i As Long
Dim lCountChars As Long
Set r = Selection.Range
lCountChars = r.Characters.Count
For i = lCountChars To 1 Step -1 'In r.Characters
Set c = r.Characters(i)
s = InputBox("Enter the phonetic equivalent")
c.PhoneticGuide Text:=s, Alignment:= _
wdPhoneticGuideAlignmentCenter, Raise:=11, FontSize:=4, FontName:= _
"Arial Unicode MS"
Next
End Sub