473,320 Members | 1,991 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,320 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 1991
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.