473,657 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 .InteropService s.COMException: Server execution failed"
when declaring new Word.Applicatio nClass().

string fileName = this.btnWorkOrd er1.Value;
object readOnly = false;
object isVisible = false;
object saveChanges = false;
object missing = System.Reflecti on.Missing.Valu e;
object dynamic = 2;

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

Word.Document oWordDoc = oWordApp.Docume nts.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 1473
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********@dis cussions.micros oft.com> wrote in message
news:44******** *************** ***********@mic rosoft.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 .InteropService s.COMException: Server execution failed"
when declaring new Word.Applicatio nClass().

string fileName = this.btnWorkOrd er1.Value;
object readOnly = false;
object isVisible = false;
object saveChanges = false;
object missing = System.Reflecti on.Missing.Valu e;
object dynamic = 2;

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

Word.Document oWordDoc = oWordApp.Docume nts.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
1647
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 Word.Application Dim wrdDoc As Word.Document Dim strFileName As String
1
1787
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 me how to achieve my goal. Any suggestions will be appreciated. Thanks and Regards.
1
1335
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 declaring new Word.ApplicationClass(). string fileName = this.btnWorkOrder1.Value; object readOnly = false; object isVisible = false; object saveChanges = false; object missing = System.Reflection.Missing.Value;
0
5706
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 recipient could not see the image in attachment. I am using Inlinepicture.Addpicture but still not working
3
3844
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 data). This works fine apart from Notes kind of hangs because it is waiting on the macro to finish. This never happens because the macro is using timer code to save every n minutes. The solution sounds simple, start the macro on the Word...
0
1296
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 'Word._Document.Close(ref object, ref object, ref object)' and non-method 'Word.DocumentEvents2_Event.Close'. Using method group. D:\Win\Nightclub\Nightclub\frmMain.cs Ambiguity between method 'Word._Application.Quit(ref object, ref object, ref...
0
1115
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 object)' and non-method 'Word.DocumentEvents2_Event.Close'. Using method group. D:\Win\Nightclub\Nightclub\frmMain.csAmbiguity between method 'Word._Application.Quit(ref object, ref object, ref object)' and non-method...
0
3999
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, though. So, I tried to find that text, and then move to the next table. Then I need to add a row to the table which already has 4 columns. I need to maintain the old content of the table too. I think I am pretty close, but having a little trouble...
0
1747
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 want to create text, tables. Word.Application WApp = new Word.Application(); // Open Microsoft Word application object objMissing = System.Reflection.Missing.Value; // create the place holder object Word.Document...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.