Random selecting images in OUTLOOK

May 27, 2010
Reaction score

I need to select images randomly for sending bday greetings to my team mates. please help me. I am not an expert in VB.


Private Sub Application_MAPILogonComplete()
Call SendBirthdayMessage
Call Application_ItemSend
End Sub
Sub SendBirthdayMessage()
Dim olkContacts As Outlook.Items, _
olkContact As Object, _
olkMsg As Outlook.MailItem
Set olkContacts = Session.GetDefaultFolder(olFolderContacts).Items
For Each olkContact In olkContacts
If olkContact.Class = olContact Then
If (Month(olkContact.Birthday) = Month(Date)) And (Day(olkContact.Birthday) = Day(Date)) Then
Set olkMsg = Application.CreateItem(olMailItem)
With olkMsg
.Recipients.Add olkContact.Email1Address
'Change Cc address as needed'
'.CC = "air(e-mail address removed)
'Change the subject as needed'
.Subject = "Many Many Happy Returns of the Day " & olkContact.FirstName
'Change the message as needed'
.HTMLBody = "<html><font= 'Tahoma'><p>Hi" & "&nbsp;" & olkContact.FirstName & _
"</p>" & _
"<img src='C:\Documents and Settings\user\My Documents\My Pictures\36.gif'>" & _

'Change Display to Send if you want the messages sent automatically'
End With
End If
End If
Set olkMsg = Nothing
Set olkContact = Nothing
Set olkContacts = Nothing
End Sub

Please help me.

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