title: Inserting hyperlink in Outlook body using Word VBA
body: <p>How can I add a hyperlink to the last part of my email combining with a text?</p>
  
  <p>This must be the last sentence in my paragraph </p>
  
  <blockquote>
    <p>"Should you have questions/clarifications, kindly reach out to Service Management at Service_Management@xyz.com"</p>
  </blockquote>
  
  <p>The word "Service_Management@xyz.com" must have a hyperlink.</p>
  
  <p>I tried editing the code from this:</p>
  
  <pre><code>wd.Hyperlinks.Add wd.Range(wd.Paragraphs.Count), _
    "mailto:Service_Management@xyz.com" &amp; "Service_Management@xyz.com"
  </code></pre>
  
  <p>The problem is the bottom part of the body of email becomes a link. And there is no text display at the body of the email. How do I declare the link properly so it won't affect the other part of the range?</p>
  
  <pre><code> Sub AUTOMAIL()
  
      Dim ol As Object 'Outlook.Application
      Dim olEmail As Object 'Outlook.MailItem
      Dim olInsp As Object 'Outlook.Inspector
      Dim wd As Object 'Word.Document
      Dim rCol As Collection, r As Range, i As Integer
      Dim Table1 As Collection
  
      Dim ETo As String
      Dim CTo As String
  
      ETo = Join(Application.Transpose(Worksheets("Data Entry").Range("AD5:AD100").Value), ";")
      CTo = Join(Application.Transpose(Worksheets("Data Entry").Range("AI5:AI15").Value), ";")
  
       '/* if outlook is running use GO, create otherwise */
      Set ol = GetObject(Class:="Outlook.Application")
      Set olEmail = ol.CreateItem(0) 'olMailItem
  
      Set Table1 = New Collection
  
      With Table1
          .Add Sheet14.Range("A1:O20")
      End With
  
      Set rCol = New Collection
      With rCol   
          .Add Sheet11.Range("a1:i1", "a6:i20")
          .Add Sheet10.Range("a1:i1", "A6:I20")
          .Add Sheet9.Range("A1:J18")
      End With
  
      With olEmail
          .To = ETo
          .CC = CTo
          .Subject = "Step+ Volume Tracker, Data Entry/Workflow Ageing Report and Rejection Report | " &amp; Format(Date, "MMMM dd, yyyy") &amp; " | 9:15AM"
  
          '/* bonus basic html */
          .HTMLBody = "&lt;html&gt;&lt;body style=""font-family:calibri""&gt;" &amp; _
                      "&lt;p&gt;&lt;b&gt;Dear All,&lt;/b&gt;&lt;br&gt;&lt;br&gt; Please see below summary of invoices and links to the &lt;b&gt;Volume Tracker&lt;/b&gt; and &lt;b&gt;Ageing Report&lt;/b&gt; (Data Entry and Workflow)." &amp; _
                      "&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"
  
             Set olInsp = .GetInspector
             If olInsp.EditorType = 4 Then 'olEditorWord
                 Set wd = olInsp.WordEditor
                 For i = 1 To Table1.Count '/* iterate all ranges */
                     Set r = Table1.Item(i): r.Copy
                     wd.Range.insertparagraphafter
                     wd.Paragraphs(wd.Paragraphs.Count).Range.PasteAndFormat 16
                     '16 - wdFormatOriginalFormatting
              Next
          End If
          wd.Paragraphs(wd.Paragraphs.Count).Range.Text = Chr(11) &amp; "Please click on this link to view the details:"
  
          Set olInsp = .GetInspector
          If olInsp.EditorType = 4 Then 'olEditorWord
              Set wd = olInsp.WordEditor
              For i = 1 To rCol.Count '/* iterate all ranges */
                  Set r = rCol.Item(i): r.Copy
                  wd.Range.insertparagraphafter
                  wd.Paragraphs(wd.Paragraphs.Count).Range.PasteAndFormat 16
                  '16 - wdFormatOriginalFormatting
              Next
          End If
  
          wd.Paragraphs(wd.Paragraphs.Count).Range.Text = Chr(11) &amp; "Please click on this link to view the details:" &amp; vbCrLf &amp; "Those who are encountering problems accessing the Sharepoint site, please refer to attachment for Data Entry and Workflow Report. " &amp; Chr(11) &amp; "Please note though that the file has been truncated, complete details of the report are available in the links indicated above." &amp; Chr(11) &amp; Chr(11) &amp; "Should you have questions/clarifications, kindly reach out to Service Management at"
          wd.Range(wd.Paragraphs(wd.Paragraphs.Count).Range.Characters(98).Start, _
          wd.Paragraphs(wd.Paragraphs.Count).Range.Characters(128).End).Font.Bold = True
  
          wd.Range.Hyperlinks.Add Anchor:=wd.Range, _
          Address:="mailto:Service_Management@xyz.com"
          wd.Range.Font.Size = 10
          .Display
  
      End With
  
  End Sub
  </code></pre>