473,385 Members | 1,863 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,385 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;
Nov 17 '05 #1
2 1550
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.

Nov 17 '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.

Nov 17 '05 #3

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

Similar topics

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...
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...
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...
7
by: - Electronic.HR - | last post by:
I have very strange and stupid problem with .NEt's webBrowser control... If I do this: ---------------------------------- private void btnGoogle_click(object sender, EventArgs e) { ...
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.