I am attempting to output a set of results into a pre-defined .XLS template file. This I have managed to achieve perfectly fine. However the process can take up to several minutes as there are alot of results to process. This halts the main thread for longer that I would like. The natural solution was to create a worker thread using AfxBeginThread, which I have done. Now all the Excel Automation is done within the worker thread function. However, all of the excel calls no longer work. ::Start() for example fails to start up excel, returns a failure and then my thread function promptly exits. I have even tried starting excel before the thread and then just using the ::Add() function calls inside the thread. Excel starts when I do this but the ::Add() function calls fail. I have come to the conclusion that Automating Excel is not possible from a worker thread. I do not call AfxBeginThread with any special parameters, simply with the name of the thread function and a NULL paramter to pass to the function. Is there something that I am missing? A setting that the worker thread should have? I assumed the thread would start with the same attributes as its parent thread and since that works that the worker thread should also work. Any help would be appreciated.
Thank you for your time,
Sino ... =)