0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

wordで日本語と英語のフォントを指定して自動変換するマクロ(ver.2)

Last updated at Posted at 2019-11-18

https://qiita.com/NE_0813_/items/e6d9725b05b7d4e6a7b6 の改良版
コメントで教えてくれた方がいたので参考にして改良
コメントで教えてくれた方の言う通りデザイン/フォントの方が数式の誤変換も修正されるしいい感じ
でも、練習したってことでアップします!

Sub Font_Change2() 'フォントの種類別一括変換
 Dim doc_all As String
 Dim doc As Range
 Dim k As Long
 With ActiveDocument
  doc_all = .Range(0, .Bookmarks("\EndOfDoc").End)
 End With
 For k = 1 To Len(doc_all)
  Set doc = ActiveDocument.Range(k - 1, k)
  With doc.Font
   If doc.Font.Name = "Cambria Math" Then '数式用のフォントを確認
   Else:
    '日本語用フォント
    .NameFarEast = "MS 明朝 (本文のフォント - 日本語)"
    '英数字用フォント
    .NameAscii = "Century (本文のフォント)"
    .Name = "MS 明朝 (本文のフォント - 日本語)"
    End If
  End With
 Next
End Sub

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?