![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi,
Is there a way to apply photo to a contact via VBA? Thanks. |
#2
|
|||
|
|||
![]()
Outlook 2003? Use the ContactItem.HasPicture Boolean to see if a picture is
there for the contact. Use the AddPicture(path) method to add a picture to the contact. For earlier versions of Outlook you'd need to add a custom control such as a picturebox to add a picture. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Programatix" wrote in message ... Hi, Is there a way to apply photo to a contact via VBA? Thanks. |
#3
|
|||
|
|||
![]()
Thanks for the quick respond.
While waiting for the respond from the newsgroup, I did some research using the Office Help and come out with the following code to add photo for each contacts. The image file should be named like the contact's name. Hope it is useful to anyone out there. Public Sub UpdateContactPhoto(ContactPhotoPath As String) 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).Ite ms 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 strPhoto = ContactPhotoPath & myContact.FileAs & ".jpg" If fs.FileExists(strPhoto) Then myContact.AddPicture strPhoto myContact.Save End If End If Next End Sub "Ken Slovak - [MVP - Outlook]" wrote in message ... Outlook 2003? Use the ContactItem.HasPicture Boolean to see if a picture is there for the contact. Use the AddPicture(path) method to add a picture to the contact. For earlier versions of Outlook you'd need to add a custom control such as a picturebox to add a picture. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Programatix" wrote in message ... Hi, Is there a way to apply photo to a contact via VBA? Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Apply Contact's Photo via VBA or DotNet? | Programatix | Outlook - General Queries | 3 | August 26th 06 09:04 PM |
how do I apply a form to one Contact? | don | Outlook - Using Forms | 1 | July 5th 06 07:40 PM |
how to apply new contact form to existing forms | Nick Cumberbatch | Outlook - Using Contacts | 1 | July 2nd 06 06:45 PM |
Paste a photo | JOHN SMITH | Outlook Express | 0 | June 5th 06 09:02 PM |
Changing Contact Info in One Folder - How to apply in other folder | atbioteach | Outlook - Using Contacts | 1 | February 3rd 06 01:27 AM |