Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai all,

I used the below code for renaming after the file uploaded to particular folder,but its working fine locally but its giving runtime error in server

C#
try
                    {
                        object oMissing = System.Reflection.Missing.Value;
                        Microsoft.Office.Interop.Excel.ApplicationClass xl = new Microsoft.Office.Interop.Excel.ApplicationClass();
                        Microsoft.Office.Interop.Excel.Workbook xlBook;
                        Microsoft.Office.Interop.Excel.Worksheet xlSheet;
                        xlBook = (Microsoft.Office.Interop.Excel.Workbook)xl.Workbooks.Open(fileLocation, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
                        xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlBook.Worksheets.get_Item(1);
                        xlSheet.Name = "New_LITM -" + 12;
                        xlBook.Save();
                        xl.Application.Workbooks.Close();
                    }
                    catch (Exception ex)
                    {
                        lblStatus.Visible = true;
                        lblStatus.Text = ex.Message;
                        lblStatus.ForeColor = System.Drawing.Color.Red;
                    }




please help me out this....
Posted
Updated 26-May-15 8:03am
v3
Comments
Deenuji 5-Dec-12 8:48am    
Where is that error?????
ZurdoDev 5-Dec-12 9:57am    
What's the error? If it works locally but not on the server it is often a permissions issue.
Malarpalanisamy 12-Dec-12 2:32am    
Run time error is appearing because of ms office is not installed on server level
thanks....

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900