I'm not sure if you're new to Outlook VBA, but if so,
http://www.slipstick.com/dev/vb.htm is a good place to start.
Otherwise, paste this code into your ThisOutlookSession module and modify
the fortune messages as you see fit. It will add the fortune message to the
end of any new e-mail messages. Hope this helps!
Option Explicit
Dim WithEvents objInspectors As Inspectors
Dim WithEvents objInspector As Inspector
Private Sub Application_Startup()
Set objInspectors = Application.Inspectors
End Sub
Private Sub Application_Quit()
Set objInspectors = Nothing
Set objInspector = Nothing
End Sub
Private Sub objInspector_Activate()
Dim strFortune As String, intRandomNumber As Integer
Dim objMailItem As Outlook.MailItem
Randomize ' Initialize random-number generator.
intRandomNumber = Int((3 * Rnd) + 1) ' Generate random value between
1 and 3.
Select Case intRandomNumber
Case 1
strFortune = "Fortune 1"
Case 2
strFortune = "Fortune 2"
Case 3
strFortune = "Fortune 3"
End Select
Set objMailItem = objInspector.CurrentItem
objMailItem.Body = objMailItem.Body & strFortune
End Sub
Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class <> olMail Then Exit Sub
Set objInspector = Inspector
End Sub
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault
LYS said:
Hi,
I am thinking of adding a random quote of the day at the bottom of my
mail automatically. Is there a ready component in Outlook that already does
this or if I were to write it myself, where should I start?