title: Outlook VBA variable into HTML Body
body: <p>I created an Macro in MS Outlook for an email. The user inputs an answer to a question which results in a variable storing that data as a string. An email is then generated in HTML with a hyperlink containing that variable. I can't seem to figure out how to concatenate the variable "strTrackingNumber" into the complete hyperlink. Any suggestions?</p>
  
  <hr>
  
  <pre><code>Option Explicit
  Sub TestFile
  
  Dim strTrackingNumber as String
  strTrackingNumber = InputBox("Please input the Tracking Number")
  Set objMsg = Application.CreateItem(olMailItem)
  
   With objMsg
    .To = "mickey.smith@surfer.com"
    .CC = ""
    .BCC = ""
    .Subject = "Forecast"
    .Categories = ""
    .BodyFormat = olFormatHTML ' send HTML message
    .HTMLBody = "&lt;style&gt; body{color:black;font-family:Arial;font-size: 12pt;}" &amp; _
  "&lt;HTML&gt;&lt;body&gt;Dear Member,&lt;br&gt;&lt;br&gt;&amp;emsp;The following document is ready for your review."&lt;a href= 'http://www.bluewave.com/' &amp; strTrackingNumber&gt;Tracking &amp; strTrackingNumber.&lt;/a&gt;&lt;/body&gt;
  
  .Display
  End With
  Set objMsg = Nothing
  End Sub
  </code></pre>
  
  <hr>
  
  <p>Output link should look like this: <a href="http://www.bluewave.com/Tracking" rel="nofollow">http://www.bluewave.com/Tracking</a> Number
  e.g. <a href="http://www.bluewave.com/RA-15-30922" rel="nofollow">http://www.bluewave.com/RA-15-30922</a></p>