メインコンテンツへスキップ

Word文書内の同じ単語のすべてのインスタンスを太字にする方法は?

Wordファイルに複数の「Outlook」テキストがある場合は、すべての「Outlook」テキストを太字でフォーマットする必要があります。 大きなWord文書内の同じ単語のすべてのインスタンスをできるだけ早く太字にするにはどうすればよいでしょうか。

VBAコードを使用してWord文書内の同じ単語のすべてのインスタンスを太字にします


VBAコードを使用してWord文書内の同じ単語のすべてのインスタンスを太字にします

次のVBAコードは、特定の単語のすべてのインスタンスをすばやく簡単に太字にするのに役立ちます。次のようにしてください。

1。 を押し続けます Alt + F11 キーを押して アプリケーション向け Microsoft Visual Basic 窓。

2。 次に、をクリックします インセット > モジュール、以下のコードをコピーして、開いた空白のモジュールに貼り付けます。

VBAコード:同じ単語のすべてのインスタンスを太字にします

Sub BoldAll()
    Dim xStr As String
    xStr = InputBox("Please enter the word that you want to bold:", "KuTools for Word")
    If Trim(xStr) = "" Then
        MsgBox "Cann’t be empty!", vbInformation, "KuTools for Word"
    End If
    With ActiveDocument.Content.Find
        .ClearFormatting
        .Text = xStr
        .Replacement.ClearFormatting
        .Replacement.Font.Bold = True
        .Replacement.Text = "^&"
        .Wrap = wdFindStop
        .Format = True
        .Forward = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub

3。 コードを挿入した後、を押します F5 キーを押して実行すると、太字にしたい単語を挿入するように促すダイアログボックスが表示されます。スクリーンショットを参照してください。

doc太字の特定の単語1

4。 次に、をクリックします OK ボタンをクリックすると、すべての特定の単語が一度に太字としてフォーマットされます。

最高のオフィス生産性向上ツール

Kutools for Word - Over で単語体験を向上させましょう 100 注目すべき機能!

🤖 Kutools AI アシスタント: AI であなたの文章を変革します - コンテンツを生成する  /  テキストを書き換える  /  文書を要約する  /  情報のお問い合わせ 文書に基づいて、すべて Word 内で

📘 ドキュメントマスタリー: 分割ページ  /  ドキュメントをマージする  /  選択内容をさまざまな形式でエクスポート (PDF/TXT/DOC/HTML...)  /  PDFへの一括変換  /  ページを画像としてエクスポート  /  複数のファイルを一度に印刷する...

コンテンツ編集: バッチ検索と置換 複数のファイルにわたる  /  すべての画像のサイズを変更する  /  テーブルの行と列を転置する  /  表をテキストに変換...

🧹 楽にお掃除:振り払って 余分なスペース  /  セクションブレーク  /  すべてのヘッダー  /  テキストボックス  /  ハイパーリンク  / その​​他の取り外しツールについては、当社の Web サイトをご覧ください。 グループを削除...

クリエイティブインサート:挿入 千の区切り文字  /  チェックボックス  /  ラジオボタン  /  QRコード  /  バーコード  /  斜線テーブル  /  方程式のキャプション  /  画像キャプション  /  テーブルキャプション  /  複数の写真  / 詳細については、 グループを挿入...

🔍 正確な選択: ピンポイント 特定のページ  /  テーブル  /  シェイプ  /  見出し段落  / ナビゲーションを強化する 他には? 機能の選択...

スターの強化: あらゆる場所に素早く移動  /  繰り返しのテキストを自動挿入  /  ドキュメントウィンドウをシームレスに切り替える  /  11 変換ツール...

👉 これらの機能を試してみませんか? Kutools for Wordは、 60日無料トライアル、制限なし! 🚀
 
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Que isso, salvou meu dia no escritório. Muito obrigado!
This comment was minimized by the moderator on the site
Using Google Translate, this is what Stef had said,
"Hello and thank you for this piece of VBA code.

I work on documents that contain keywords explained like this <#myKeyword>
I would like to identify and bold all the elements that are between < and >.

Is this possible in VBA and could you guide me?

Best to you. (A friendly regard used between people who exchange services or information.)

Stef"

Separately, I, Kaitlyn, was wondering if I could use code to bold all questions.
This comment was minimized by the moderator on the site
Bonjour et merci pour ce bout de code VBA.

Je travaille sur des documents qui contiennent des mots clés explicités de la sorte <#monMotClé>
je souhaiterais repérer et mettre en gras tous les éléments qui se trouvent entre < et >.

est-ce que cela est possible en VBA et pourriez vous me guider ?

Bien à vous.

Stef
This comment was minimized by the moderator on the site
Hello, Stef,
Sorry, I can't understand your question clearly, could you explain your problem in English?
Thank you!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations