A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to improve the email item selection event performance?



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old October 11th 09, 06:19 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to improve the email item selection event performance?



If you want to handle one item only, there's no need to loop through all the
collection. Instead, just work with Selection(1).

But I suppose what takes long is accessing the commandbar button, and that's
the code we don't see. If it's always the same button, keep its reference,
so you don't need to find it again and again.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Sun, 11 Oct 2009 01:54:01 -0700 schrieb paresh:

Hi,

I have noticed some issues with handling explorer change event when

mailbox
is large. I have Outlook add-in which handles explorer change event like
below and displays senders name as a button caption which is created on
Outlook toolbar. It takes long sometimes to change the caption button.

Could you tell me how could I optimize the single email item selection

event?

Thanks,
Paresh

My code:

Private WithEvents objExpl As Outlook.Explorer

Friend Sub InitHandler(olApp As Outlook.Application, strProgID As String)
Set objExpl = objOutlook.ActiveExplorer 'Explorer Object
End Sub

Private Sub objExpl_SelectionChange()
If objExpl.Selection.Count 0 Then
For Each objMailItem In objExpl.Selection
If objMailItem.Class = olMail Then
msgbox "email item";
End If
Next
End If
End Sub

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MSG File - Trap Explorer Selection Change Event DG Outlook and VBA 8 January 11th 10 09:03 AM
On click event for mail item selection Mark Outlook and VBA 4 December 15th 08 02:31 AM
Slow performance while accessing Outlook item fields using VSTO Maxim Add-ins for Outlook 3 November 16th 06 03:08 PM
Which event is triggered when user saves email item? Kasper Add-ins for Outlook 4 September 22nd 06 02:26 PM
how to improve performance of Outlook Raj Menon Outlook - Installation 3 February 27th 06 03:25 PM


All times are GMT +1. The time now is 03:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.