title: Search structured text in Outlook body
body: <p>I need to find a line in a selected mail and copy it.</p>
  
  <p>The line contains</p>
  
  <blockquote>
    <p>Mailbox:          ????????????????</p>
  </blockquote>
  
  <p>The number of symbols in that line are different </p>
  
  <p>The mail looks somewhat like this</p>
  
  <pre><code>Mailbox Details
  ==============================================================================
  Mailbox:          /xxxxxx/xxxxxxxxxx/xxxxxxxxx
  Message Name:     xxxxxxxxxxxxxxxxxxxxxxxxx
  Message Id:       xxxxxxxxxxxxxxx
  ==============================================================================
  </code></pre>
  
  <p>The copied line should go into the subject of a new mail created by the code.</p>
  
  <p>All I am missing is how to copy the line into the subject.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Sub SterlingForward()    
      Set objItem = ForwardB()
      Set objItem = ForwardA()
  End Sub
  
  
  Function ForwardA() As Object
      Dim oAccount As Outlook.Account
      Dim initialSubj, finalSubj As String
      Dim oMail As Outlook.MailItem
      Set oMail = Application.ActiveExplorer.Selection(1).Reply
      oMail.SentOnBehalfOfName = "lol@.herp.com"
      oMail.To = "lol@.herp.com"
      oMail.Display
  
      Set myitem = Application.ActiveInspector.CurrentItem
      initialSubj = myitem.Subject
      initialBod = myitem.Body
  
      finalSubj = ??????????????????????
  
      finalBody = "Hello Team," + vbCrLf + "resend was successful" + vbCrLf &amp; CStr(initialBod)
      myitem.Subject = finalSubj
      myitem.Body = finalBody
  End Function
  
  
  Function ForwardB() As Object
      Dim objMail As Outlook.MailItem
      Dim initialSubj, initialBod, finalSubj, finalBody As String
      Set objItem = GetCurrentItem()
      Set objMail = objItem.Forward
      objMail.To = "lol@derp.com"
      objMail.Display
      Set objItem = Nothing
      Set objMail = Nothing
  
      Set myitem = Application.ActiveInspector.CurrentItem
      initialSubj = myitem.Subject
      initialBod = myitem.Body
  
      finalSubj = ????????????????????????????
  
      finalBody = "Hello Team," + vbCrLf + "resend was successful" + vbCrLf &amp; CStr(initialBod)
      myitem.Subject = finalSubj
      myitem.Body = finalBody
  End Function
  
  
  Function GetCurrentItem() As Object
      Dim objApp As Outlook.Application
      Set objApp = Application
      On Error Resume Next
      Select Case TypeName(objApp.ActiveWindow)
      Case "Explorer"
      Set GetCurrentItem = _
      objApp.ActiveExplorer.Selection.Item(1)
      Case "Inspector"
      Set GetCurrentItem = _
      objApp.ActiveInspector.CurrentItem
      Case Else
      End Select
  End Function
  </code></pre>