I am writing a webservice in C#.Net. I added the reference to Microsoft.Office.Interop.Word. When I attempt to do Documents.Open, I get the following error:
Can someone pleease help.
Thanks
Guha
Error
System.Runtime.InteropServices.COMException (0x800A1066): Command failed
The Code:
strWordTemplateFile = Server.MapPath(AppSettings.SupportingDocumentsLocation + "/LicenseOrderConfirmation.doc");
strWordDocumentFile = "c:\\temp\\LicenseOrderConfirmation.doc";
objWordDocumentFile = "c:\\temp\\LicenseOrderConfirmation.doc";
Microsoft.Office.Interop.Word.ApplicationClass objWord = new Microsoft.Office.Interop.Word.ApplicationClass();
System.IO.File.Copy(strWordTemplateFile,strWordDocumentFile,true);
object objVisible = false;
objWord.Visible = false;
objWord.Documents.Open(ref objWordDocumentFile,ref missing, ref missing, ref missing,ref missing,
ref missing,ref missing, ref missing, ref missing, ref missing, ref missing,
ref objVisible,ref missing,ref missing, ref missing, ref missing);
Can someone pleease help.
Thanks
Guha
Error
System.Runtime.InteropServices.COMException (0x800A1066): Command failed
The Code:
strWordTemplateFile = Server.MapPath(AppSettings.SupportingDocumentsLocation + "/LicenseOrderConfirmation.doc");
strWordDocumentFile = "c:\\temp\\LicenseOrderConfirmation.doc";
objWordDocumentFile = "c:\\temp\\LicenseOrderConfirmation.doc";
Microsoft.Office.Interop.Word.ApplicationClass objWord = new Microsoft.Office.Interop.Word.ApplicationClass();
System.IO.File.Copy(strWordTemplateFile,strWordDocumentFile,true);
object objVisible = false;
objWord.Visible = false;
objWord.Documents.Open(ref objWordDocumentFile,ref missing, ref missing, ref missing,ref missing,
ref missing,ref missing, ref missing, ref missing, ref missing, ref missing,
ref objVisible,ref missing,ref missing, ref missing, ref missing);