title: Subject not being replaced by VBA Macro
body: <p>Okay so, I'm trying to edit this code I found that allows me to input variable information into a pop up box for emails. This is great and works flawlessly (although kinda slow), however I'm running into a weird issue trying to do the same thing with the subject line as well.</p>
  <p>Using one template that I have set up, <a href="https://i.stack.imgur.com/D1Jta.png" rel="nofollow noreferrer">working template</a> I get exactly what I'm looking for, it goes through all 4 of the variables INCLUDING the one on the subject line.</p>
  <p>However, if I use a different template with the same variables, <a href="https://i.stack.imgur.com/ZuY1a.png" rel="nofollow noreferrer">Not working template</a>, it doesn't replace the subject line. The other two variables in the broken template pop up the dialog box - <a href="https://i.stack.imgur.com/BrRDQ.png" rel="nofollow noreferrer">example</a></p>
  <p>Can someone help fill me in on why it works on one template but not the other?</p>
  <p>Full code:</p>
  <pre><code>Private WithEvents m_Inspectors As Outlook.Inspectors
  Private WithEvents m_Inspector As Outlook.Inspector
  
  Private Sub Application_Startup()
  Set m_Inspectors = Application.Inspectors
  End Sub
  
  Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
  If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then
  'Handle emails only
  Set m_Inspector = Inspector
  End If
  End Sub
  
  Private Sub m_Inspector_Activate()
  
  Dim Item As MailItem
  Dim Value As String
  
  If TypeOf m_Inspector.CurrentItem Is MailItem Then
  
  Set mail = m_Inspector.CurrentItem
  
  'Identify the message subject
  If mail.Subject = &quot;FMAudit Legacy Install [custbusiness]&quot; Or mail.Subject = &quot;FMAudit Install [custbusiness]&quot; Then
   
      'Check message format
      If mail.BodyFormat = OlBodyFormat.olFormatPlain Then
  
          'Replace [date] with the entered value
          If InStr(mail.Body, &quot;[custname]&quot;) &gt; 0 Then
           Value = InputBox(&quot;Enter the customer name&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
            mail.Body = Replace(mail.Body, &quot;[custname]&quot;, Value)
           End If
          End If
       
          'Replace [percent] with the entered value
          If InStr(mail.Body, &quot;[custbusiness]&quot;) &gt; 0 Then
             Value = InputBox(&quot;Enter business name&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
              mail.Body = Replace(mail.Body, &quot;[custbusiness]&quot;, Value)
           End If
          End If
          
          'Replace [percent] with the entered value
          If InStr(mail.Body, &quot;[custhost]&quot;) &gt; 0 Then
             Value = InputBox(&quot;Enter host name&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
              mail.Body = Replace(mail.Body, &quot;[custhost]&quot;, Value)
           End If
          End If
       
      Else
           
          'Replace [date] with the entered value
          If InStr(mail.HTMLBody, &quot;[custname]&quot;) &gt; 0 Then
           Value = InputBox(&quot;Enter the customer name&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
            mail.HTMLBody = Replace(mail.HTMLBody, &quot;[custname]&quot;, Value)
           End If
          End If
       
          'Replace [percent]; with the entered value
          If InStr(mail.HTMLBody, &quot;[custbusiness]&quot;) &gt; 0 Then
             Value = InputBox(&quot;Enter business name&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
              mail.HTMLBody = Replace(mail.HTMLBody, &quot;[custbusiness]&quot;, Value)
           End If
          End If
          
          'Replace [percent]; with the entered value
          If InStr(mail.HTMLBody, &quot;[custhost]&quot;) &gt; 0 Then
             Value = InputBox(&quot;Enter host name&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
              mail.HTMLBody = Replace(mail.HTMLBody, &quot;[custhost]&quot;, Value)
              
          'Replace [percent] with the entered value
          If InStr(mail.Subject, &quot;[custbusiness]&quot;) &gt; 0 Then
             Value = InputBox(&quot;Enter business name subject&quot;)
       
           If Value &lt;&gt; &quot;&quot; Then
              mail.Subject = Replace(mail.Subject, &quot;[custbusiness]&quot;, Value)
           End If
          End If
          
           End If
          End If
       
      End If
  
  End If
  
  Set mail = Nothing
  
  End If
  End Sub
  </code></pre>