I researched Office Automation on this website and found many useful articles. The most useful was the "Building an Office2K COM addin with VC++/ATL" article by Mr. Dey. I have a dll that is used for MS Word Automation. I put a button on the toolbar which saves whatever is typed in and quits the application. I have a problem, though, after about the 3rd or 4th time of entering MS Word, MS Word will crash. I have isolated the crash to the invoke statement for the Quit:

//Invoke the Quit method
szFunction = OLESTR("Quit");
hr = m_spApp->GetIDsOfNames(IID_NULL, &szFunction, 1,

hr = m_spApp->Invoke(dispid_Quit, IID_NULL, LOCALE_USER_DEFAULT,

I am not sure what the problem is. I found an article on MSDN that has this exact same code. So why would the Invoke GPF? Could it be that I am missing the Release statements (m_spApp->Release)? I modeled my dll after the example in the article "Building an Office2K COM addin with VC++/ATL" so m_spApp is actually a private member in the .h file. HELP!