Random selecting images in OUTLOOK

Joined
May 27, 2010
Messages
1
Reaction score
0
Hi,

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

Code:

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'
.Send
End With
End If
End If
Next
Set olkMsg = Nothing
Set olkContact = Nothing
Set olkContacts = Nothing
End Sub

Please help me.
Vivek
 

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

Top