Click here to Skip to main content
13,771,078 members
Rate this:
Please Sign up or sign in to vote.
See more:
this code is working fine i use it on visual studio for opening a word file but while using on iis it shows error ' Object reference not set to an instance of an object'..Please suggest me this file path problem or some thing else

Microsoft.Office.Interop.Word.ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
                      object fileName = Server.MapPath("~/Uploadhtml/" + docname);
                      object readOnly = false;

                      object isVisible = true;
                      object missing = System.Reflection.Missing.Value;
                      WordApp.Visible = true;

                      Microsoft.Office.Interop.Word.Document aDoc = WordApp.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);

Posted 23-Aug-12 21:42pm
Updated 2-Jan-18 0:22am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Check your file path and location.
I guess Server.MapPath("~/Uploadhtml/" + docname); is where you need to fix the issue.
ridoy 24-Aug-12 3:05am
atul tr 24-Aug-12 3:11am
can u tell me what to do Uploadhtml is a folger which is inside of my application .is there any other correct way to give the path

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.181119.1 | Last Updated 2 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100