[2005] Problems with Word automation
I have written some simple code to open a word or .doc file in word 2003.
It works fine but when I copy my application over to another machine which has 2003 installed on it and run it nothing happens.
Its strange as I have try catch blocks around almost everything but there are no exceptions being thrown.
When I try to open my doc file the hourglass appears ......then nothing.
Any ideas folks.
I wrote this code ages ago and can't even remember what references where made
Re: [2005] Problems with Word automation
is the path you use to locate Word the same on both machines? My guess is that they have Word installed on different location...
Re: [2005] Problems with Word automation
There both in the same place but I don't really think that should matter. Here is the code I am using :
Code:
Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document oWordDoc = new Microsoft.Office.Interop.Word.Document();
//Make word visible
oWord.Visible = true;
//Add document object to the word objects document collection
oWordDoc = oWord.Documents.Open(ref oFilename,ref oMissing, ref oTrue, ref oFalse, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);