
デジタル校正の入門[ワード編]
校正の世界でもデジタル化の波は年々進んでいますが、まだまだ人に置き換わるツールは存在しません。現在の校正に関するデジタルツールは、部分部分で活用することで、その効果を最大に発揮できるものがほとんどです。
【関連記事】≫ デジタル校正の入門[エクセル編]
そんなデジタルツールですが、有料のソフトを購入したり、ネットでフリーソフトを探したりしなくても、自分で作ることができます。自分で作るといってもそんなに難しくはありません。
ここではワードのマクロを使用しますが、あらかじめマクロのコードを用意していますので、コピペと文字入力さえできれば、誰でも簡単にできるようになっています。
非常にシンプルなマクロですので、今までマクロに一度も触れたことがないという方でも、すぐに自分用にカスタマイズすることが可能です。
このマクロを使えば、表記ゆれや体裁の修正が一括でできます。検索置換の完全一致で修正しますので精度は100%です。ひと手間かけるだけで、後工程の負荷を軽減することが可能になります。
すぐに活用する機会がなくとも、知識だけでも頭に入れておいて、自分の業務で使える部分はないか探してみてください。
1.体裁を整える(全角英字を半角に直す)
最初は、体裁の一括修正を行うところから始めます。文書の体裁が修正されるだけでも、校正の負担を軽減させることができます。
【準備】
まずは、ワードで新しい文書を作成します。もしくは、既存の文書をコピーしたものを用意してください。
※マクロを使って修正したものは「Ctrl+z」で取り消しができません。
▼ ここから順を追って、全角の英字を半角に自動で直す説明をしていきます。
(1)
どこの行でも大丈夫ですので、全角で「ABC」と入力してください。
その下に、半角で「ABC」と入力します(※これは単に比較用です)。
■ ここで入力した全角の「ABC」を、自動で半角の「ABC」に修正できるように設定します。
(2)
「表示」タブ⇒「マクロ」⇒「マクロの表示」と進みます。
(3)
マクロの表示をクリックすると、下の画面が出てきます。
1.「マクロ名」の欄にマクロの名前を入力します。何でも大丈夫ですが、ここでは『全角英字を半角に』とします。
2.「マクロの保存先」は、今開いている文書(ここでは「文書1(文書)」)を選択してください。
※「作業中のすべての文書とテンプレート」にすると、他の文書にもマクロが保存されます。
3.その後、作成ボタンを押してください。
(4)
マクロの編集画面です。
この画面の最終行の『End Sub』のすぐ上の行に、下のコードをコピペします。
※Windows用です。
With Selection.Find
.Text = "A"
.Replacement.Text = "A"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "B"
.Replacement.Text = "B"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "C"
.Replacement.Text = "C"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
▼ コードについての説明
コードは、3つのブロックで構成されています。○と○の部分以外は3つともすべて同じです。
(1)~(3)は、すべて同じ動きをするコードです。
(1)を見てみると、全角の「A」を検索して、半角の「A」に置き換えるという指示です。
(2)(3)も同様です。
(5)
コピペし終えたら、右上の「×」ボタンで一旦マクロの編集画面を閉じてください。自動で保存されます。
(6)
再度、「マクロの表示」からマクロの画面を表示させます。
(7)
あとは、「実行」を押すだけです。
これで(1)で入力した全角の「ABC」が半角に変わります。
(8)
結果です。
比較用に入力した半角の「ABC」と同じものになっているはずです。
基本的な手順はこれで終了です。
ここでは、ABCの3文字だけでしたが、記事の最後に『全角の英数字を半角に直すコード』の完全版を用意していますので、この手順て試してみてください。
少し手間をかけるだけで、全角の英数字が何千文字あっても、一瞬で半角に修正することができます。さらに、全角半角の混在は英数字だけではありませんので、記号類などにも応用して使えます。
2.表記を修正する1
このマクロで文章の表記も修正することができます。
▼ 文章を入力するとき、あらかじめ統一すべき文言が決まっているのであれば、マクロに設定しておくことで、事前に正しい表記に修正することができます。
(1)
「マクロの表示」から、マクロの画面を表示させます。
「編集」を選択します。
(2)
マクロの編集画面が表示されます(※最初にコードをコピペした画面です)。
ここで以下の部分の文字を修正してください。
--------------------------------------------------
・赤枠の全角の「A」を「下さい」に修正
・青枠の半角の「A」を「ください」に修正
--------------------------------------------------
→これで「下さい」を「ください」に修正するコードができます。
修正できたら、右上の「×」ボタンでマクロの画面を閉じます。自動で保存されます。
(3)
文書に「下さい」と入力してください。
(4)
再度、「マクロの表示」からマクロの画面を表示させます。
あとは、「実行」を押すだけです。
(4)
結果です。
「下さい」が「ください」に置き換わります。
この要領で、任意の文字の置き換えができます。
3.表記を修正する2
▼ ここからは、「下さい」と「ください」の応用です。
(1)
「マクロの表示」⇒「編集」と進み、「マクロの編集画面」を開きます。
「Bを置換するコード」と「Cを置換するコード」を下にコピペします。
このような結果になります。
(2)
「下さい」と「ください」に修正した手順で以下の文字に修正します。
----------------------------------------
□頂く ⇒ □いただく
□又は ⇒ □または
□一つづつ ⇒ □一つずつ
□内臓 ⇒ □内蔵
----------------------------------------
入力できたら、右上の「×」ボタンでマクロの画面を閉じます。自動で保存されます。
(3)
文書に「下さい」「頂く」「又は」「一つづつ」「内臓」と入力します。
(4)
再度、「マクロの表示」からマクロの画面を表示させます。
あとは、「実行」を押すだけです。
(5)
結果です。
すべての文字が、置き換わっていると思います。
このようにコードの一部を修正するだけで、どんな文字にも置き換えることができます。
気を付けておきたいこと
▼ 気を付けておきたいこと。
・マクロで行った修正は強制的に上書き保存されますので「Ctrl+z」で取り消しができません。そのため、文書を複製してから作業を行ってください。
これさえ気を付けておけば、あとは何の問題もなく簡単に、文章の表記や体裁を自動で変更できます。
全角英数字を半角にするコード
▼ 前半で紹介したコードの完全版です。使用手順は(1)~(8)と全く同じです。
■ このコードで修正できること
(1)全角数字0~9を半角にする
(2)全角のa~zを半角にする
(3)全角のA~Zを半角にする
With Selection.Find
.Text = "1"
.Replacement.Text = "1"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "2"
.Replacement.Text = "2"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "3"
.Replacement.Text = "3"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "4"
.Replacement.Text = "4"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "5"
.Replacement.Text = "5"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "6"
.Replacement.Text = "6"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "7"
.Replacement.Text = "7"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "8"
.Replacement.Text = "8"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "9"
.Replacement.Text = "9"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "0"
.Replacement.Text = "0"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "a"
.Replacement.Text = "a"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "b"
.Replacement.Text = "b"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "c"
.Replacement.Text = "c"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "d"
.Replacement.Text = "d"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "e"
.Replacement.Text = "e"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "f"
.Replacement.Text = "f"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "g"
.Replacement.Text = "g"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "h"
.Replacement.Text = "h"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "i"
.Replacement.Text = "i"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "j"
.Replacement.Text = "j"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "k"
.Replacement.Text = "k"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "l"
.Replacement.Text = "l"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "m"
.Replacement.Text = "m"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "n"
.Replacement.Text = "n"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "o"
.Replacement.Text = "o"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "p"
.Replacement.Text = "p"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "q"
.Replacement.Text = "q"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r"
.Replacement.Text = "r"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "s"
.Replacement.Text = "s"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "t"
.Replacement.Text = "t"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "u"
.Replacement.Text = "u"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "v"
.Replacement.Text = "v"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "w"
.Replacement.Text = "w"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "x"
.Replacement.Text = "x"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "y"
.Replacement.Text = "y"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "z"
.Replacement.Text = "z"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "A"
.Replacement.Text = "A"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "B"
.Replacement.Text = "B"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "C"
.Replacement.Text = "C"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "D"
.Replacement.Text = "D"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "E"
.Replacement.Text = "E"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "F"
.Replacement.Text = "F"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "G"
.Replacement.Text = "G"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "H"
.Replacement.Text = "H"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "I"
.Replacement.Text = "I"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "J"
.Replacement.Text = "J"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "K"
.Replacement.Text = "K"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "L"
.Replacement.Text = "L"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "M"
.Replacement.Text = "M"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "N"
.Replacement.Text = "N"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "O"
.Replacement.Text = "O"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "P"
.Replacement.Text = "P"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Q"
.Replacement.Text = "Q"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "R"
.Replacement.Text = "R"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "S"
.Replacement.Text = "S"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "T"
.Replacement.Text = "T"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "U"
.Replacement.Text = "U"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "V"
.Replacement.Text = "V"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "W"
.Replacement.Text = "W"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "X"
.Replacement.Text = "X"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Y"
.Replacement.Text = "Y"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Z"
.Replacement.Text = "Z"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = True
.MatchByte = True
End With
Selection.Find.Execute Replace:=wdReplaceAll