简体   繁体   English

如何编辑 MS Word 系统宏

[英]How to edit a MS Word system macro

I use MS Word for Mac Version 16.45 with German as main language.我使用 MS Word for Mac 版本 16.45,以德语为主要语言。 I want to write furigana in Japanese.我想用日语写假名。 This is possible by using Phonetic Guides.这可以通过使用语音指南来实现。 However, this function has a well known bug (in Word for Mac only ).然而,这个 function 有一个众所周知的错误(仅在 Word for Mac 中)。 The furigana are positioned left above the kanji, even if you selected center position.即使您选择了中心 position,假名也位于汉字的左上方。

在此处输入图像描述

Selecting the field function of the kanji results in the lower string选择汉字的字段 function 导致较低的字符串

{q \* jc2 \* "Font:UD Digi Kyokasho N-R" \* hps14 \o\ad(\s\up 13(しん),新)}

Changing the comma at the very end to a semicolon and deselecting the field function results in the correct result.将最后的逗号更改为分号并取消选择字段 function 会产生正确的结果。

在此处输入图像描述

The VBA object catalog shows me, that the macro in charge is the Range.PhoneticGuide-Methode . VBA object 目录向我显示,负责的宏是Range.PhoneticGuide-Methode It seems to me, that the parameter wdPhoneticGuideAlignmentCenter is set to a wrong value.在我看来,参数wdPhoneticGuideAlignmentCenter设置为错误的值。

Fixing this bug shouldn't be a big deal, but:修复这个错误应该没什么大不了的,但是:

Is it possible to edit the Range.PhoneticGuide-Methode?是否可以编辑 Range.PhoneticGuide-Methode? And where can I find the VBA code?我在哪里可以找到 VBA 代码?

Unless you have written a macro to apply the Phonetic Guide there isn't a macro involved, so there isn't any VBA code to find.除非您编写了一个宏来应用语音指南,否则不涉及宏,因此没有任何 VBA 代码可供查找。

If there is a bug then it is in Word and all you can do is report it to Microsoft.如果有错误,那么它在 Word 中,您所能做的就是向 Microsoft 报告。

You can't edit the method but you can use the method.您无法编辑该方法,但您可以使用该方法。 Place the following in a VBA module in your Normal template and then you can execute it on the selection in your document.将以下内容放在 Normal 模板中的 VBA 模块中,然后您可以在文档中的选择上执行它。

Sub PhoneticGuide()
    Selection.Range.PhoneticGuide Text:="tray sheek", _
     Alignment:=wdPhoneticGuideAlignmentCenter, _
     Raise:=11, FontSize:=7
     
    'other alignment options
'     Alignment:=wdPhoneticGuideAlignmentLeft, _
'     Alignment:=wdPhoneticGuideAlignmentOneTwoOne, _
'     Alignment:=wdPhoneticGuideAlignmentRight, _
'     Alignment:=wdPhoneticGuideAlignmentRightVertical, _
'     Alignment:=wdPhoneticGuideAlignmentZeroOneZero, _

End Sub

I've included the available alignment options that you can experiment with to find the one that works for you.我已经包含了可用的 alignment 选项,您可以尝试找到适合您的选项。 I copied the base code from the following Microsoft article, which you can use for further reference.我从以下 Microsoft 文章中复制了基本代码,您可以将其用于进一步参考。

https://docs.microsoft.com/en-us/office/vba/api/word.range.phoneticguide https://docs.microsoft.com/en-us/office/vba/api/word.range.phoneticguide

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM