473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Getting "FileNotFoundException" when initialize a Word ApplicationCalass variable

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;
Oct 3 '05 #1
2 1995
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.

<ks**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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;
.
.
.
private void button2_Click(object sender, System.EventArgs e)
{
Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();
}

The problem:
When I click the button, I got an exception,

An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in WindowsApplication1.exe
Additional information: The specified module could not be found.

What could be the problem??? I need to open a word document in the
runtime. But I am getting this error at the initial stage itself.
Please help me.

Oct 3 '05 #2
Ron
Make this change:

Word.Application oWordApp = new Word.Application();

.... and it'll work

"ks**********@gmail.com" wrote:
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;
.
.
.
private void button2_Click(object sender, System.EventArgs e)
{
Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();
}

The problem:
When I click the button, I got an exception,

An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in WindowsApplication1.exe
Additional information: The specified module could not be found.

What could be the problem??? I need to open a word document in the
runtime. But I am getting this error at the initial stage itself.
Please help me.

Oct 3 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Sanford | last post by:
I'm getting a Sysmte.IO.FileNotFoundException when executing the code below. It is straight from the example. This works on one machine, but not the other. Other benign calls invoke the same...
2
by: ksskumar2000 | last post by:
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...
0
by: Sean Patterson | last post by:
Greets all, I have a simple CSV parsing .NET web app where the user uploads the file and the web app does the magic. I have been able to get it to run on my personl workstation and our sanbox,...
5
by: MattC | last post by:
Hi, I am getting the following error: System.IO.FileNotFoundException: C:\Dreamtxt\WebSites\mysite\www\feedback.aspx at System.Web.UI.TemplateParser.GetParserCacheItem() at...
1
by: Ram | last post by:
Hey, I have a Class Library project that is installed in the Gac (- strong name and all...). In this Class Library, I keep getting an exception when I try to instatiate one of MS's object ( - to...
0
by: nilesh shah via DotNetMonster.com | last post by:
Imports Microsoft.Office.Interop ..... Public wordObj As Word.ApplicationClass ....... some function() If wordObj Is Nothing Then wordObj = New Word.Application end if
5
by: SGRing | last post by:
I have a c# application that I'm migrating from 2003 to 2005, and I moved it to another machine. It built ok. But, when trying to run I get System.IO.FileNotFoundException was unhandled...
1
by: Mongo | last post by:
I am getting the following error when I try to run a new webservice I have placed on any one of 4 windows 2003 servers. (Running under ASP.NET 1.1) To minimize the problem, I created a simple...
2
by: jjlagtap | last post by:
Hey everyone When I try to open a file i get the Exception listed below. The weird thing is it works when I run the web app locally and when i use a remote server and open a file on my computer....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.