title: How do I set up an email template with dynamic dates or alternatively, create a macro to insert a date?
body: <p>I have a template for a report I send out every week and in four separate places (three in the body, one in the subject line) is a date that corresponds to the Monday of the prior week.  (Basically, it's a "week of" date for the week I'm reporting, which is always the previous week.)</p>
  
  <p>I want to add a date to where I have the cursor.  (If I could somehow set up bookmarks in the template for where I want the date added, that would be even better.)  I've done a lot of research on inserting text and I keep running into the same two problems with the examples I've been finding:</p>
  
  <ol>
  <li><p>I can write a macro that will open up a new message and populate various areas (subject line, body, etc.), but I can't get that macro to work on just a message that I already have open.</p></li>
  <li><p>For all of the examples I've tried that actually run on the message that I already have open, I can only get it to add text to the body.  I was hoping to create something simple like how Word does:</p>
  
  <pre><code>Selection.TypeText Text:="Hello!"
  </code></pre></li>
  </ol>
  
  <p>None of these approaches have worked for me.</p>
  
  <hr>
  
  <p><strong>*edit #1:</strong> Of course, right after I post this, I find that one of the solutions I found to simply add text to where the cursor is now works.</p>
  
  <pre><code>TypeName(Application.ActiveWindow) = "Inspector" Then
      SendKeys Format(Now, "MMMM dd, yyyy")
      DoEvents
  End If
  </code></pre>
  
  <p>If I stick with this approach, I just need to know how to set it up so that instead of today's date, it inserts the date from the prior week's Monday (I don't always run the report on the same day, so I can't just tell it to do something simple like subtract eight days from today's date).  I'd also like to know if I can tell it to insert that date into multiple places by doing something like a find/replace.</p>
  
  <hr>
  
  <p><strong>*edit #2:</strong> I've also come across a decent example of a quick find/replace for the body.  The only problem with it is that it completely strips out any and all formatting, including tables, colors, etc.</p>
  
  <pre><code>Dim Insp As Inspector
  Dim obj As Object
  
      Set Insp = Application.ActiveInspector
      Set obj = Insp.CurrentItem
  
      obj.Body = Replace(obj.Body, "xxxxxxxxxx", Format(Now - 8, "MMMM dd, yyyy"))
  
      Set obj = Nothing
      Set Insp = Nothing
  </code></pre>
  
  <p>(You may also notice I added a <code>-8</code> to the date format.  I figured that if I can't get it to always add the exact date I'm looking for, I can at least get it close.)</p>