How to determine whether ContactItem in Outlook is displayed or not (dispose properly)

D_Bester

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?

Dmitry Streblechenko

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find Outlook AppointmentItem for ContactItem

From Dev

Determine if an Ad displayed and whether it was clicked

From Dev

How to use dispose() properly?

From Dev

How to properly dispose of ThreadLocal variables?

From Dev

How to properly dispose of a pthread mutex?

From Dev

How to properly dispose objects in Flambe?

From Dev

Determine whether a ListView has been displayed it's own and DEFAULT VerticalScrollbar?

From Dev

Determine whether a ListView has been displayed it's own and DEFAULT VerticalScrollbar?

From Dev

How to properly use the dispose method on a class

From Dev

How to dispose properly using async and await

From Dev

How to properly dispose of pinvoke/unmanaged code

From Dev

How to properly dispose the stream when using StreamContent

From Dev

How to properly use the dispose method on a class

From Dev

How to properly dispose of pinvoke/unmanaged code

From Dev

How to close or dispose of TCP client properly?

From Dev

Codility : Brackets Determine whether a given string of parentheses is properly nested

From Dev

How to determine whether a memory page is mmaped in C

From Java

How to determine whether to use <filesystem> or <experimental/filesystem>?

From Dev

How to determine whether a string represents an integer?

From Dev

how to determine whether the directory is empty directory with nodejs

From Dev

How to reliably determine whether Passbook is available?

From Dev

How to determine whether floated element has wrapped

From Dev

How to determine whether EC Point is on curve?

From Dev

How to determine whether file share server is online?

From Dev

How to determine whether a function exists in a POSIX shell?

From Dev

How do I determine whether a UIImage is empty?

From Dev

How to determine whether the object is a value type

From Dev

How does angular determine whether jQuery is present?

From Dev

How to determine whether a path is containing a format at the end?

Related Related

  1. 1

    Find Outlook AppointmentItem for ContactItem

  2. 2

    Determine if an Ad displayed and whether it was clicked

  3. 3

    How to use dispose() properly?

  4. 4

    How to properly dispose of ThreadLocal variables?

  5. 5

    How to properly dispose of a pthread mutex?

  6. 6

    How to properly dispose objects in Flambe?

  7. 7

    Determine whether a ListView has been displayed it's own and DEFAULT VerticalScrollbar?

  8. 8

    Determine whether a ListView has been displayed it's own and DEFAULT VerticalScrollbar?

  9. 9

    How to properly use the dispose method on a class

  10. 10

    How to dispose properly using async and await

  11. 11

    How to properly dispose of pinvoke/unmanaged code

  12. 12

    How to properly dispose the stream when using StreamContent

  13. 13

    How to properly use the dispose method on a class

  14. 14

    How to properly dispose of pinvoke/unmanaged code

  15. 15

    How to close or dispose of TCP client properly?

  16. 16

    Codility : Brackets Determine whether a given string of parentheses is properly nested

  17. 17

    How to determine whether a memory page is mmaped in C

  18. 18

    How to determine whether to use <filesystem> or <experimental/filesystem>?

  19. 19

    How to determine whether a string represents an integer?

  20. 20

    how to determine whether the directory is empty directory with nodejs

  21. 21

    How to reliably determine whether Passbook is available?

  22. 22

    How to determine whether floated element has wrapped

  23. 23

    How to determine whether EC Point is on curve?

  24. 24

    How to determine whether file share server is online?

  25. 25

    How to determine whether a function exists in a POSIX shell?

  26. 26

    How do I determine whether a UIImage is empty?

  27. 27

    How to determine whether the object is a value type

  28. 28

    How does angular determine whether jQuery is present?

  29. 29

    How to determine whether a path is containing a format at the end?

HotTag

Archive