Getting "FileNotFoundException" when initialize a Word ApplicationCalass variable

  • Thread starter Richard T. Edwards
  • Start date
R

Richard T. Edwards

Suggestion:

To see if its the interop issue, start a new project and add only the
reference to the Runtime.InteropServices:
using System.Runtime.InteropServices

Then in your event:

private void button2_Click(object sender, System.EventArgs e)
{

Object[] myargs = new Object[1];

myargs[0] = true;

System.Type TWord = System.Type.GetTypeFromProgID("Word.Application.9");
System.Object WordAp = System.Activator.CreateInstance(TWord);
WordAp.GetType().InvokeMember("Visible",
System.Reflection.BindingFlags.SetProperty, null, WordAp, myargs);

}

This should create an instnace of word and set the visible property to true.
If this works -- as it does on my machine -- then there's a very good chance
you have a Microsoft.Office.Interop issue. Also, try referencing only the
Microsoft Word 11.0 Object Library, too.

hth.
 
K

ksskumar2000

Hi,

I have added following two reference under COM tab,
Microsoft Office 11.0 Object Library
Microsoft Word 11.0 Object Library

The software I have used:
Visual studio 1.14
Microsoft Office 2003

I have installed Office XP PIAs

My program:

using Microsoft.Office.Interop ;
using System.Runtime.InteropServices;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top