I saw in your area the following code for photos. Can we please change it immediately so if I copy a photo from some place online, and I run the code, it puts that photo in the photo of the contact I select or open. That would wonderful as well, as it helps doing it much faster for contacts.
Public Sub UpdateContactPhoto()
Dim myOlApp As outlook.Application
Dim myNamespace As outlook.NameSpace
Dim myContacts As outlook.Items
Dim myItems As outlook.Items
Dim myItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
For Each myItem In myContacts
If (myItem.Class = olContact) Then
Dim myContact As outlook.contactItem
Set myContact = myItem
Dim strPhoto As String
' use myContact.LastNameAndFirstName = "last, first.jpg" format
' replace "C:\photos\" with the correct path.
strPhoto = "C:\Users\Username\Pictures" & myContact.fullname & ".jpg"
' use for testing only, to confirm the path is correct.
' Delete or comment out
' MsgBox (strPhoto)
If fs.FileExists(strPhoto) Then
myContact.AddPicture strPhoto
myContact.Save
End If
End If
Next
End Sub
Public Sub UpdateContactPhoto()
Dim myOlApp As outlook.Application
Dim myNamespace As outlook.NameSpace
Dim myContacts As outlook.Items
Dim myItems As outlook.Items
Dim myItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
For Each myItem In myContacts
If (myItem.Class = olContact) Then
Dim myContact As outlook.contactItem
Set myContact = myItem
Dim strPhoto As String
' use myContact.LastNameAndFirstName = "last, first.jpg" format
' replace "C:\photos\" with the correct path.
strPhoto = "C:\Users\Username\Pictures" & myContact.fullname & ".jpg"
' use for testing only, to confirm the path is correct.
' Delete or comment out
' MsgBox (strPhoto)
If fs.FileExists(strPhoto) Then
myContact.AddPicture strPhoto
myContact.Save
End If
End If
Next
End Sub