Click here to Skip to main content
13,044,428 members (114,007 online)
Rate this:
 
Please Sign up or sign in to 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

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 5-Dec-12 2:12am
Updated 26-May-15 8:03am
v3
Comments
Deenu India 5-Dec-12 8:48am
   
Where is that error?????
ryanb31 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 26 May 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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