![]() |
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 |
#3
|
|||
|
|||
![]()
Thank you.
The error happens in the statement : Set item.Image4.Picture = objContactPhotoSource.stockPhoto.Picture "this object doesn't manage this property or method" Image4 is an Image Control on the form which is running the script. objContactPhotoSource is an Image Control on a oneOffed form where I store photographs. I checked for the existence of objects (see updated code below) Note that if there is no match for LastName, i never set nor dim the objContactPhotoSource by the time I test it with is noting, and that in this case, I don't get the expected msgBox but "object required" error message. Function Item_Open() Set objNameSpace = Item.Application.GetNameSpace("MAPI") set fold1 = objNameSpace.Folders("Dossiers publics") set fold2 = fold1.Folders("Tous les dossiers publics") set fold3 = fold2.Folders("test") set fold4 = fold3.Folders("oneOffedForms") Set objContacts = fold4.Items iNumItems = objContacts.Count For i = 1 to iNumItems set objContact = objContacts.item(i) msgbox("boucle : " & i) if objContacts is nothing then msgbox("objContacts is nothing") if objContact is nothing then msgbox("objContact is nothing") If objContact.LastName = item.LastName then msgBox("last name match") If objContact.LastName = item.LastName then set objContactPhotoSource = objContact if objContactPhotoSource is nothing then msgbox("objContactPhotoSource is nothing") If objContact.LastName = item.LastName then Set item.Image4.Picture = objContactPhotoSource.stockPhoto.Picture 'if item.Image4.Picture is nothing then msgbox("item.Image4.Picture") Next End Function "Hollis Paul [MVP - Outlook]" a écrit : In article , =?Utf-8?B?cGhpbGlwcGU=?= wrote: But all what I get is an error telling me that this object can not use the method or property. Any idea what's going wrong ? Anytime you create or get an object from an existing source you should test for its being nothing. From the code you show, you have no idea what operation is failing. Time to put in some debugging code to find out which operation that is. -- Hollis Paul Mukilteo, WA USA |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Email object | JMG | Outlook and VBA | 1 | April 21st 06 03:27 PM |
You made changes to another copy of this object... | Noppie | Outlook - General Queries | 0 | February 20th 06 06:53 PM |
Object can not be found | naguaramipana | Outlook - General Queries | 3 | January 30th 06 06:17 AM |
picture export | Tomkat743 | Outlook and VBA | 1 | January 9th 06 07:55 AM |
Include PictureFormatHTML send picture will not remain checked | JimM | Outlook Express | 3 | January 9th 06 03:12 AM |