Thread: [Solved] Automating dates
View Single Post
 
Old 03-19-2013, 08:58 AM
niton niton is offline Windows 7 64bit Office 2010 64bit
Competent Performer
 
Join Date: Jul 2012
Posts: 102
niton is on a distinguished road
Default

Try this

Code:
Sub CreateDated_TF() 
    
    Dim MyItem As Outlook.MailItem
    Set MyItem = Application.CreateItem(olMailItem) 

    MyItem.Subject = "report for: " & Format(Date, "mm/dd/yy")

    Text_TF = "…I ran the report using:  " & Format(Date-1, "mm/dd/yy") & _
        vbCR & "….I ran this report using " & Format(Date, "mm/dd/yy")

    MyItem.Body = Text_TF
    MyItem.Display 

End Sub

Sub CreateDated_M() 
    
    Dim MyItem As Outlook.MailItem
    Set MyItem = Application.CreateItem(olMailItem) 

    MyItem.Subject = "report for: " & Format(Date, "mm/dd/yy")

    Text_M = "…I ran the report using:  " & Format(Date-3, "mm/dd/yy") & _
        " and " & Format(Date-2, "mm/dd/yy") & _
        vbCR & "….I also ran this report using " & Format(Date, "mm/dd/yy")

    MyItem.Body = Text_M
    MyItem.Display 

End Sub

If the text is not quite right see here for HTML example. http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

If you are not familiar with VBA see here. http://www.slipstick.com/outlook-dev...ks-vba-editor/





*******************
Consider rating the thread by going to the "Rate Thread" dropdown.
Reply With Quote