If the user has the contact open in an inspector then I want to save and Set itm = Nothing
but not close the contact. If the contact is not open then I want to save and dispose.
Dim mfFolder As MAPIFolder
Set mfFolder = GetContactsFolder 'function to get folder
Dim itm As ContactItem
Set itm = mfFolder.Items.Find("[Account] = " & Chr(34) & AcctNum & Chr(34))
'or...
Set itm = ActiveInspector.CurrentItem
'or...
Set itm = ActiveExplorer.Selection.Item(1)
This closes the item which is fine if it is not open in an inspector:
Call itm.Close(olSave)
Set itm = Nothing
Or if the item is open in an inspector window then I want to save without closing:
Call itm.Save
Set itm = Nothing
So once I have the item, how do i determine whether it is open in an inspector window so I can dispose of it properly?
First, instead of calling Close(olSave), you can simply call ContactItem.Save - that will save the item wwithout closing it.
Secondly, you can compare the values of the EntryID property for the item that your code references and the item returned by Inspector.CurrentItem.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments