Supporting threads in Outlook VBA application

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.
 
K

Ken Slovak - [MVP - Outlook]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top