title: Insert bold text into Word using VBA
body: <p>I wrote a little script that exports certain Excel cell values into Word. However, certain inserts need to be bold. And there doesn't seem to be an easy way to do this.</p>
  
  <p>This code loops through the records and adds them to the Word document</p>
  
  <pre><code>
  Do While intRow &lt; intTotalRows + 1
  
                  strTemp = " ;b;" & Range("G" & intRow).FormulaR1C1 & " " & Range("I" & intRow).FormulaR1C1 & ";e; "
  
                  If strTemp &lt;&gt; strCur Then
                      strCur = strTemp
                      .Content.Font.Bold = True
                      .Content.InsertAfter strCur
                  End If
  
                  .Content.Font.Bold = False
                  .Content.InsertAfter Range("A" & intRow).FormulaR1C1 & " - " & Range("C" & intRow).FormulaR1C1 & " " & Range("E" & intRow).FormulaR1C1 & " * "
  
              intRow = intRow + 1
          Loop
  </code></pre>
  
  <p>Turning on bold before inserting text and turning it off again afterwards seems like the most logical solution, so it does not work.</p>
  
  <p>I then tried to find and replace the text, but that also did not work:</p>
  
  <p><pre><code>
          .Content.Find.ClearFormatting
          With .Content.Find
              .Text = ";b;" 'Look for
              .Replacement.Text = ";bbb;" 'Replace with
              .Forward = True
              .Wrap = wdFindContinue
              .Format = False
              .MatchCase = False 
              .MatchWholeWord = False
              .MatchWildcards = False 
              .MatchSoundsLike = False
              .MatchAllWordForms = False
          End With</p>
  
  <pre><code>    .Content.Find.Execute Replace:=wdReplaceAll
  </code></pre>
  
  <p></pre></code></p>