Before making OLE calls, you need to set the current thread to Single Thread Apartment (STA) mode. Make sure that the Main function is marked with STAThreadAttr