Don't know if this is the right group or not but any how. I found this Automation stuff for Word at this site. The Code Project. Your visual Studio .Net homepage. I followed all the directions on the page, downloaded the example and it works fine. Did the COM referance thing and all seemed fine, but it doesn't work. I'm not even into this COM stuff so as the subject says I'm in over my head here. This is what I have for an error code: Unable to cast COM object of type 'Word.ApplicationClass' to interface type 'Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)). The line with the asterik * is where the errro occurs. This is the routin that I made to access this. Had to change the number of Ref's for Word V 9.0 to 12.
protected void WordBtn_Click(object sender, EventArgs e)
{
object fileName = @"F:\Forms\ASM_Danville_7new.rtf";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
* Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
//, ref isVisible,
//ref missing,ref missing,ref missing,
//ref missing,ref missing,ref missing,);
oWordDoc.Activate();
}
Interesting to me is the fact that it will work from the IDE. It creates 2 instances of Word in the Task Manager, but it does open and displays my file. So can any one tell me how to possibly fix this or what I need to do. These are the files created in the Bin directory: Interop.Microsoft.Office.Core.dll Interop.Office.dll Interop.VBIDE.dll Interop.Word.dll