Solved

Confused why write is denied

Posted on 2004-08-27
2
778 Views
Last Modified: 2008-01-09
PROBLEM:  Error Message:  System.Runtime.InteropServices.COMException (0x800A1424): Word cannot save or create this file. The disk may be full or write-protected.
Try one or more of the following:
* Free more memory.
* Make sure that the disk you want to save the file on is not full, write-protected, or damaged.
 (W:\040827133831895.do
   at Word.DocumentClass.SaveAs(Object& FileName, Object& FileFormat, Object& LockComments, Object& Password, Object& AddToRecentFiles, Object& WritePassword, Object& ReadOnlyRecommended, Object& EmbedTrueTypeFonts, Object& SaveNativePictureFormat, Object& SaveFormsData, Object& SaveAsAOCELetter)
   at BuyersFund.BFFaxCOM.BFFaxCOM.GenerateRequest()


======================================

Here is the code for BFFaxCOM.GenerateRequest(  )



public bool GenerateRequest()
            {
                  try
                  {
                  
                        //genFuncs.SendMessage("benb@buyersfund.com","GenerateRequest was called","GenerateRequest was called");
                        //genFuncs.SendMessage("tom@buyersfund.com","GenerateRequest was called","GenerateRequest was called");
                        bool doc_exists_already = false;
                        string strSQL="";
                        bool documentGenerationFinished = false;
                        FillDocValues(this.DocRequestIDFromDocumentRequestTable);
                        string tempFileName = "";
                        FAXCOM_DATASET = genFuncs.GenerateDataSet(FAXCOM_SQL_STATEMENT,this.strPipelineDBConnection);
                        
                        lock(this)
                        {
                              documentGenerationFinished = CreateDocument();
                        }

                        if(documentGenerationFinished)
                        {
                              tempFileName = DocRequestUseThisFileNameForDocument;
                              doc_exists_already = File.Exists(tempFileName);
                              object fileName = tempFileName;
                              object SaveChanges = true;
                              oWord.ActiveDocument.SaveAs(ref fileName,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);            
                              oWord.ActiveDocument.Close(ref SaveChanges, ref oMissing, ref oMissing);

                              DateTime dt = new DateTime();
                              dt = DateTime.Now;
                              long iRequestID = GetDocReqIDGivenUniqueFileName(tempFileName);
                              if(doc_exists_already==false)
                              {
                                    strSQL = "insert into documentTracking (DocumentRequestID, DateRecorded, MessageReturned) values(" + iRequestID + ", '" + dt + "', 'Document has been created')";
                                    SqlConnection connection = new SqlConnection(strDBConnection);
                                    SqlCommand command = new SqlCommand(strSQL, connection);
                                    connection.Open();
                                    lock(this)
                                    {
                                          int numrows = command.ExecuteNonQuery();
                                    }
                              }
                              
                        }
//                        throw new Exception("ERROR HANDLING TESTING");
                        return documentGenerationFinished;
                  }
                  catch(Exception eee)
                  {
                        genFuncs.SendMessage("tom@buyersfund.com","PROBLEM FOUND IN FAXCOM","PROBLEM:  Error Message:  " + eee.ToString());
                        return false;
                  }
            }



0
Comment
Question by:knowlton
2 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 500 total points
Comment Utility
It must be because u are trying to save the word document into a folder where u do not have sufficient permissions.
There is a work around is suggested for this problem

http://www.kbalertz.com/kb_230155.aspx


0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
Guess what it was?

Needed to use a UNC path vs a mapped drive to the share.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now