Outlook Outlook 2003-formatting vba Date stamp

Mar 29, 2012
Reaction score

Is there something I can add to my Outlook code to reformat the Date from mm/dd/yyyy to a date format that uses the month name instead of number? Also, is there any way to place the date in a specific part of the email body? Right now it appears at the bottom left of the email body. Thanks! :)

Here's what I'm using:
 Sub StampDateHTML()
    Dim objOL As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Dim objItem As Object
    Dim strStamp As String
    On Error Resume Next
    Set objOL = Application
    Set objItem = objOL.ActiveInspector.CurrentItem
    If Not objItem Is Nothing Then
        If objItem.BodyFormat = olFormatHTML Then
            Set objNS = objOL.Session
            strStamp = "<p>" & Date
            objItem.HTMLBody = Replace(objItem.HTMLBody, _
                               "</body>", _
                               strStamp & "</body>", _
                               , , vbTextCompare)
        End If
    End If
    Set objOL = Nothing
    Set objNS = Nothing
    Set objItem = Nothing
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads