0
0

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で日本語と英語のフォントを指定して自動変換するマクロ

Last updated at Posted at 2019-11-18

業務で使えそうなマクロを作成したのでメモ

Sub Font_Change() 'フォントの種類別一括変換
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)
If doc.Font.Name = "Cambria Math" Then '数式用のフォントを確認
ElseIf doc.Text Like "[^ぁ-んァ-ヶ一-龠〃々〆〇。-゚]" Then '日本語識別
doc.Font.Name = "MS 明朝 (本文のフォント - 日本語)" '日本語フォント
ElseIf doc.Text Like "[A-Za-zA-Za-z]" Then '英語識別
doc.Font.Name = "Century (本文のフォント)" '英語フォント
Else: doc.Font.Name = "MS 明朝 (本文のフォント - 日本語)" 'その他のフォント
End If
Next
End Sub

マクロの使い方
https://kekaku.addisteria.com/wp/20180608164803

0
0
2

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?