473,394 Members | 1,787 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,394 software developers and data experts.

Help!! Problem instantiating WORD object using C#.NET

Hi experts,

I am trying to open the content of a WORD file from C#.NET which resides in
the REMOTE SERVER, however I get an error:
"System.Runtime.InteropServices.COMException: Server execution failed"
when declaring new Word.ApplicationClass().

string fileName = this.btnWorkOrder1.Value;
object readOnly = false;
object isVisible = false;
object saveChanges = false;
object missing = System.Reflection.Missing.Value;
object dynamic = 2;

//error here:
Word.ApplicationClass oWordApp = new Word.ApplicationClass();

Word.Document oWordDoc = oWordApp.Documents.Open(ref file, ref missing, ref
readOnly, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing,
ref missing, ref missing, ref isVisible);
Does anybody know how to solve it? Please help!!!

Thanks alot!!!
Handy Mulia
Nov 19 '05 #1
1 1451
Hi Handy,

If you're doing this from an ASP.NET application the most likely culprit is
security as the NETWORK SERVICE or ASPNET account which typically run
ASP.NET applications doesn't have rights to either execute a remote object
or open a file on a remote server.

To fix you will either have to give these accounts special rights in
DCOMCNFG with the Word object, or else you have to use Impersonation in your
application to elevate rights.

Here are a couple of WebLog entries that might help:

http://west-wind.com/weblog/posts/2153.aspx
http://west-wind.com/weblog/posts/1572.aspx
+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

"Handy Mulia" <Ha********@discussions.microsoft.com> wrote in message
news:44**********************************@microsof t.com...
Hi experts,

I am trying to open the content of a WORD file from C#.NET which resides
in
the REMOTE SERVER, however I get an error:
"System.Runtime.InteropServices.COMException: Server execution failed"
when declaring new Word.ApplicationClass().

string fileName = this.btnWorkOrder1.Value;
object readOnly = false;
object isVisible = false;
object saveChanges = false;
object missing = System.Reflection.Missing.Value;
object dynamic = 2;

//error here:
Word.ApplicationClass oWordApp = new Word.ApplicationClass();

Word.Document oWordDoc = oWordApp.Documents.Open(ref file, ref missing,
ref
readOnly, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing,
ref missing, ref missing, ref isVisible);
Does anybody know how to solve it? Please help!!!

Thanks alot!!!
Handy Mulia

Nov 19 '05 #2

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

Similar topics

0
by: Ronny Sigo | last post by:
Hello all, In my application I have to open a predefined MS Word document. I do this with the following code: Dim sDatum As String sDatum = Date Dim sNaamschrijver As String Dim appWord As...
1
by: Sakharam Phapale | last post by:
Hi All, I am working on Text editor. We are using Microsoft Word object for Spelling checking and correcting. Now I want to add new word in Word dictionary using Word object. Can anyone guide...
1
by: Handy Mulia | last post by:
I am trying to open the content of a WORD file from C#.NET which resides in the REMOTE SERVER, however I get an error: "System.Runtime.InteropServices.COMException: Server execution failed" when...
0
by: Balakrsihna | last post by:
Hi All, Can anyone tell me how to replace an image in MS Word 2003 using c#.net. I am converting an html file to word doc and sending this as attachment using System.Web.Mail; the...
3
by: Martin Austin | last post by:
Here's my problem. I'm launching an MS Word object on a Notes document Postopen event. The script kicks off a macro that saves the Word document to a temporary file every n minutes (backup of key...
0
by: Ronald S. Cook | last post by:
I'm trying to open the Word object model, read some text and then close the document and app. But I get this when trying to close the document and application... Ambiguity between method...
0
by: Ronald S. Cook | last post by:
I'm trying to open the Word object model, read some text and then close the document and app. But I get this. Ambiguity between method 'Word._Document.Close(ref object, ref object, ref...
0
by: funeeldy | last post by:
I need to locate a particular table in a document. I cannot hardcode the table number since it could be different in every doc. I do have some header text that comes right before it consistently,...
0
by: Pramod Elig | last post by:
I developed this code which works fine in my current system which has office 2007, but when I run in word 2000 this doesn’t work. Can you please help me to code word automation using late binding. I...
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: 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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.