Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The specified module could not be found (URGENT)

Status
Not open for further replies.

swreng

MIS
Jun 22, 2006
90
GR
Hi to all,

I have the following code which opens a word document and then save it as RTF format.

The problem is the following the code is working perfect from a development machine but it has an error on another development machine this:

"An unhandled exception of type System.IO.FileNotFoundException in windowsapplication1.exe additional information: The specified module could not be found.

The above error happens during the declaration of OoWordApp ApplicationClass.

Both machines have the same office 2003 and the same Windows XP SP2.

Please i need your help

Many thanks!

public void ImportFromWordToTern(string filepath,string RTFPath)
{

object fileName = @filepath;
object fileName2 = @RTFPath+@"\"+ this.tmstamp() + @"_eproduction.rtf";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
object savechanges=false;
object originalformat=System.Reflection.Missing.Value;
object format=(object)Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
string temp="";
string rtfdata="";



Microsoft.Office.Interop.Word.ApplicationClass oWordApp =new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.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 missing,ref missing,ref missing, ref missing);
oWordDoc.SaveAs(ref fileName2,ref format,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);
oWordApp.Quit(ref savechanges,ref originalformat,ref originalformat);
 
Look at the project references. Make sure it does not have a yellow exclaimation mark in it. If it does, remove the reference and add it back in.
 
Hi JurkMonkey

I have check refereneces and it seems be correct there isn't yellow exclaimation i remove it all and declare it again but nothing change.

Thank you!
 
Oh - now that I read the other half of your post... Check what values you are passing in to the function. Does the path you are sending in exist?

Double Check...
 
Unfortunately the values passing in the function are correct the error happens during the declaration of

Microsoft.Office.Interop.Word.ApplicationClass oWordApp =new Microsoft.Office.Interop.Word.ApplicationClass();

I can understand what's going on and what is the difference between the two machines.
 
Is the same version of Word/Office installed on both development machines?

Rhys
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense Edsgar Dijkstra

Church of the Flying Spaghetti Monster
 
Hi Rhys666
Yes there isn't any difference between the two enviroments
they have Windows XP SP2 and office 2003.


Thank you!
 
Are all required project references set to copy locally where needed, (i.e., they're not in the GAC)

Rhys
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense Edsgar Dijkstra

Church of the Flying Spaghetti Monster
 
All references are correct

There isn't any yellow exclaimation i check all the files and it seems be tha same.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top