有一段访问word的程序,是使用MFC编写的。这段程序是从MSDN里找出来的。可是却访问失败,我不知道问题出在了哪里?程序如下,希望高手们帮我看看问题。我加入的是msword9.olb。运行到oWordApp.CreateDispatch("Word.Application")的时候,就创建失败了。void CAutomatingClientWithMFCDlg::OnOK() 
{    COleVariant vTrue((short)TRUE),
                vFalse((short)FALSE),
                vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);    //Start a new instance of Microsoft Word
    _Application oWordApp;
    if (!oWordApp.CreateDispatch("Word.Application"))//就是这里!!!
    {
        AfxMessageBox("CreateDispatch failed.", MB_OK | MB_SETFOREGROUND);
        return;
    }
    
    //Create a new document
    Documents oDocs;
    _Document oDoc;
    oDocs = oWordApp.GetDocuments();
    //oDoc = oDocs.Add(vOpt, vOpt);  
    //Note for Word 2000: The Add method has 4 arguments in Word 2000.  If 
    //you wrapped the classes from the Word type library (msword9.olb),
    //modify the Add method to provide 4 optional arguments:
    oDoc = oDocs.Add(vOpt, vOpt, vOpt, vOpt);      //Add text to the document
    Selection oSel;
    oSel = oWordApp.GetSelection();
    oSel.TypeText("one");
    oSel.TypeParagraph();
    oSel.TypeText("two");
    oSel.TypeParagraph();
    oSel.TypeText("three");    //Save the document
    _Document oActiveDoc; 
    oActiveDoc = oWordApp.GetActiveDocument();
    oActiveDoc.SaveAs(COleVariant("c:\\doc1.doc"), 
                    COleVariant((short)0),
                    vFalse, COleVariant(""), vTrue, COleVariant(""),
                    vFalse, vFalse, vFalse, vFalse, vFalse);    //Quit the application
    oWordApp.Quit(vOpt, vOpt, vOpt);

CDialog::OnOK();
}