Supporting threads in Outlook VBA application

  • Thread starter Thread starter paresh
  • Start date Start date
P

paresh

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.
 
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.
 
Back
Top