Got error after open excel file from server..During Export Excel File

this error appears if you have tried to save a workbook on a drive and you do not have Modify and Delete permissions to the location where the file is being saved. It is also possible that another user has a read lock on the file.
Excel saves a file using three steps (if the file already exists in the target location):
Creates a temporary file with a randomly generated name, such as 4CCA4100.
Deletes the original file.
Renames the temporary file to the original file name.
If Excel cannot delete the original file or cannot rename the temporary file, this error message appears.
To temporarily work around this problem (providing another user does not have a read lock on the file), save the workbook to a local hard disk, or to a folder where you do have Modify and Delete rights. You may then be able to copy the file to the network drive.
This problem can also appear if you have an antivirus program installed either on your computer or on the network server. If this is the case, you may want to temporarily turn off or remove the antivirus program. If Microsoft Office Excel begins to save files correctly, contact the anti-virus vendor and ask if there is an update or correction to this problem.
More information about this error message online.

3/20/2009 4:09:11 PM 91979 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 30

Can we see your code? I got this sort of error before after saving a PDF file to disk. For me, it was an error in my code.

"If you have knowledge, let others light their candles in it."
— Margaret Fuller
3/20/2009 6:14:29 PM


        public static void ExportMediaPlan(string fileName, DataSet dsMediaPlan, int custId, string typeOfFile)
            #region Member

            List<string> List = null;
            Application oXL = null ;
            Workbook oWB = null ;
            Worksheet oSheetSecond = null ;
            Worksheet oSheet = null ;
            Range oRng= null ;
            Range xlsRange = null ;
            Range xlRangecell = null ;
            object oMissing = System.Reflection.Missing.Value;

            #endregion Member


                #region Initialization.........

                GC.Collect();// clean up any other excel guys hangin' around...
                oXL = new Application();
                oXL.Visible = false;
                oXL.DisplayAlerts = false;
                oWB = (Workbook)(oXL.Workbooks.Add(true));
                oSheet = (Worksheet)oWB.Worksheets[1];
                oSheet.Name = "Media Plan";
                oSheetSecond = (Worksheet)oWB.Worksheets.Add(Type.Missing, oSheet, 1, Type.Missing);
                oSheetSecond.Name = "Lists";

                #endregion Initialization.........

                #region Header Creation For Sheet Name Media Plan and Entire Creation of Sheet Name Lists .............

                int i = 1;
                for (int j = 0; j < dsMediaPlan.Tables[0].Columns.Count; j++)
                    oSheet.Cells[1, j + 1] = dsMediaPlan.Tables[0].Columns[j].ColumnName;
                    if (Enum.IsDefined(typeof(Enumeration.FieldName), dsMediaPlan.Tables[0].Columns[j].ColumnName))

                        oSheetSecond.Cells[1, i] = dsMediaPlan.Tables[0].Columns[j].ColumnName;
                        List = Enumeration.GetDropDownList(dsMediaPlan.Tables[0].Columns[j].ColumnName, custId);
                        int iRowNew = 2;
                        for (int data = 0; data < List.Count; data++)
                            oSheetSecond.Cells[iRowNew, i] = List[data].ToString();
                        string s1 = ColumnLetter(i) + "2";
                        oSheetSecond.get_Range(s1, ColumnLetter(i) + (List.Count + 1)).Name = dsMediaPlan.Tables[0].Columns[j].ColumnName;


                #endregion Header Creation For Sheet Name Media Plan.............

                #region Data Display in Sheet Name Media Plan.....................

                int rowLimit;
                rowLimit = (typeOfFile == Enumeration.TypeOfFile.template.ToString()) ? 50 : dsMediaPlan.Tables[0].Rows.Count;
                int iRow = 2;
                for (int iR = 0; iR < rowLimit; iR++)
                    int cellNum = 0;
                    foreach (DataColumn dc in dsMediaPlan.Tables[0].Columns)
                        string s1 = string.Empty;
                        string formula = string.Empty;
                        bool formulaCheck = Enum.IsDefined(typeof(Enumeration.FieldName), dc.ColumnName.ToString());
                        if (formulaCheck)
                            s1 = ColumnLetter(dc.Ordinal + 1) + iRow;
                            formula = "=" + dc.ColumnName.ToString();
                            xlsRange = oSheet.get_Range(s1, s1);
                            xlsRange.Validation.Add(XlDVType.xlValidateList, XlDVAlertStyle.xlValidAlertStop, System.Type.Missing, formula, System.Type.Missing);
                            xlsRange.Validation.ShowError = false;
                            if (typeOfFile != Enumeration.TypeOfFile.template.ToString())
                                xlsRange.Formula = dsMediaPlan.Tables[0].Rows[iR][dc].ToString().Replace("''", "'");
                                xlsRange.Interior.Color = System.Drawing.ColorTranslator.ToWin32(System.Drawing.Color.LightBlue);
                            if (typeOfFile != Enumeration.TypeOfFile.template.ToString())
                                oSheet.Cells[iRow, cellNum + 1] = dsMediaPlan.Tables[0].Rows[iR][dc].ToString().Replace("''", "'");
                                xlRangecell = (Range)oSheet.Cells[iRow, cellNum + 1];
                                xlRangecell.Interior.Color = System.Drawing.ColorTranslator.ToWin32(System.Drawing.Color.LightBlue);

                #endregion Data Display in Sheet Name Media Plan.....................

                #region Format First Row of Both Sheets..................

                //Format A1:Z1 as bold, vertical alignment = center.
                oSheetSecond.get_Range("A1", "IV1").Font.Bold = true;
                oSheetSecond.get_Range("A1", "IV1").VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
                //AutoFit columns A:Z.
                oRng = oSheetSecond.get_Range("A1", "IV1");
                //Format A1:Z1 as bold, vertical alignment = center.
                oSheet.get_Range("A1", "IV1").Font.Bold = true;
                oSheet.get_Range("A1", "IV1").VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
                //AutoFit columns A:Z.
                oRng = oSheet.get_Range("A1", "IV1");
                oXL.Visible = false;
                oXL.UserControl = false;

                #endregion Format First Row of Both Sheets..................

                #region Display Excel File....................

                System.IO.Directory.GetAccessControl(fileName, System.Security.AccessControl.AccessControlSections.Access);

                System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName);
                fileInfo.IsReadOnly = false;

                oWB.SaveAs(fileName, Type.Missing, Type.Missing,
                    Type.Missing,Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing,
                    Type.Missing, Type.Missing, Type.Missing, Type.Missing);

                #endregion Display Excel File....................

                dsMediaPlan = null;
                oWB.Close(true, fileName, Type.Missing);

            catch (Exception theException)
                throw theException;
                #region CleanUp all Objects......................
                oXL = null;
                oSheet = null;
                oWB = null;
                oSheetSecond = null;
                GC.Collect(); // force final cleanup!
                #endregion CleanUp all Objects......................

3/24/2009 1:26:12 PM

Web resources about - Got error after open excel file from server..During Export Excel File -

X.Org Server - Wikipedia, the free encyclopedia
X.Org Server refers to the X server release packages stewarded by the X.Org Foundation , which is hosted by , and grants public ...

Price Drop: MyAudioStream Pro UPnP audio player and streamer: gather your music collection from your ...
MyAudioStream Pro UPnP audio player and streamer: gather your music collection from your PC, NAS, UPnP servers, Windows Media Player or iTunes ...

Intel Rising; Street Likes Stable Outlook; Server Cracks Appear
... ( MU ) might not move fast enough with the “ 3D Xpoint ” technology the two are developing. Some cracks are appearing in Intel’s server market ...

Dell announces Datacenter Scalable Solutions server line
In an effort to expand its share of the server market, Dell has announced today that it will be launching a new line of servers targeting companies ...

Bloodborne servers taken down for 'emergency maintenance'
An exploit and other "serious issues" have been detected.

Latest Windows Server 2016 beta shows off Microsoft's new containers
Microsoft launched the fourth technical preview for the next version of Windows Server on Thursday, giving the public access to its new Hyper-V ...

Senator Wonders If Hillary Is Covering Legal Expenses For Tech Firm That Managed Her Email Server
Senator Wonders If Hillary Is Covering Legal Expenses For Tech Firm That Managed Her Email Server

Quanta, Wiwynn see more orders from server clients for 2016
Quanta Computer and Wiwynn, a server subsidiary of Wistron, are expected to land more cloud server orders from their clients in 2016 as Internet ...

Server Files Sexual Harassment Complaint Against Pigalle Restaurant
... restaurant Pigalle is being accused of sexual harassment by a waitress , who says that management implied her jeans were "too much." The server ...

Microsoft Previews Hyper-V Containers for Windows Server 2016
Wondering how Hyper-V containers work in Microsoft's upcoming server software release? Intrepid administrators and developers can get an early ...

Resources last updated: 12/3/2015 5:10:38 PM