Your technology certification is waiting. Enroll in Cloud Class ®
Sub AutoAddContact(Item As MailItem)
Dim olkContacts As MAPIFolder, _
olkContact As ContactItem, _
olkReply As MailItem, _
olkRecip As Recipient, _
strAddress As String
Set olkContacts = Outlook.Application.Session.GetDefaultFolder(olFolderContacts)
Set olkContact = olkContacts.Items.Find("[FullName] = '" & Item.SenderName & "'")
If TypeName(olkContact) = "Nothing" Then
Set olkContact = Outlook.Application.CreateItem(olContactItem)
Set olkReply = Item.Reply
Set olkRecip = olkReply.Recipients.Item(1)
If Err = 0 Then
strAddress = olkRecip.Address
If strAddress = "" Then
strAddress = olkRecip.Name
.Email1Address = strAddress
.FullName = Item.SenderName
'Feel free to remove the next line'
.Body = "Record created automatically on " & Date & " at " & Time & " by BlueDevilFan's script."
Set olkContact = Nothing
Set olkContacts = Nothing
Set olkReply = Nothing
Set olkRecip = Nothing
Open in new window
This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.