Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

Confused why write is denied

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;
                  }
            }



ASKER CERTIFIED SOLUTION
Avatar of 123654789987
123654789987

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tom Knowlton

ASKER

Guess what it was?

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