I want to delete MS Word rubi in VBA

Asked 2 years ago, Updated 2 years ago, 116 views

Good job, everyone.

Use this code to add furigana.
https://stackoverflow.com/questions/34602598/how-to-add-phonetic-guides-to-all-the-texts-at-once

How do I delete rubies on a VBA?

Thank you for your cooperation.

chopsticks

vba ms-word

2022-09-30 20:13

1 Answers

You can remove rubies by specifying an empty string in the Text parameter of the Range.PhoneticGuide method.For example, the ActiveDocument.Fields property can be used to obtain the desired Range object.

Delete all rubies in the subtext()
For Eachf In ActiveDocument.Fields
  f.Select
  Selection.Range.PhoneticGuide""
Next
End Sub

This property also contains non-rubi field codes, but the PhoneticGuide method will corrupt the field codes.If you need to avoid such a case, you need to determine if it is true by using Field.Code.FormattedText or Field.Type.

See also


2022-09-30 20:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.