Help!

Supporting threads in Outlook VBA application

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  how can I move my tasks to Outlook on another com..  
Author Message
paresh
External


Since: Apr 24, 2009
Posts: 5



PostPosted: Tue Oct 20, 2009 4:11 am    Post subject: Supporting threads in Outlook VBA application
Archived from groups: microsoft>public>outlook>program_vba (more info?)

Hi,

I have written an Outlook VBA add-in that retrieves a free/busy information
for users/conference rooms and I expect it to take 10-15 seconds each time. I
am planning to create individual thread for each process so that it could be
done faster. Could you help me to write something like below code in VBA.

For i=1 to nusers
Create Thread for getting free/busy status for ith user;
Next
Wait for each threads to be terminated.

Also let me know what are the extra care I need to take care while using
thread in VBA code.

Thanks.
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3355



PostPosted: Tue Oct 20, 2009 9:39 am    Post subject: Re: Supporting threads in Outlook VBA application [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Don't do that.

The Outlook object model is not suitable or supported for working in
anything but the main thread, not from any background threads. If you
attempt to spawn a thread to do what you want and it accesses the Outlook
object model in any way you will crash or hang Outlook.

You've heard of best practices? That's a worst practice.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"paresh" <paresh.DeleteThis@discussions.microsoft.com> wrote in message
news:0AF324DA-0B35-4A3E-BB2B-6F38C72390EA@microsoft.com...
> Hi,
>
> I have written an Outlook VBA add-in that retrieves a free/busy
> information
> for users/conference rooms and I expect it to take 10-15 seconds each
> time. I
> am planning to create individual thread for each process so that it could
> be
> done faster. Could you help me to write something like below code in VBA.
>
> For i=1 to nusers
> Create Thread for getting free/busy status for ith user;
> Next
> Wait for each threads to be terminated.
>
> Also let me know what are the extra care I need to take care while using
> thread in VBA code.
>
> Thanks.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum