Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 03, 2012 02:13 PM by syynapse
Aug 02, 2010 02:47 PM|LINK
Hello good people,
I have this beast as an error. Did my research and found some posts here as well but did not do any good for me.
Here is what I did. I had an error regarding issue rights with COM objects so I gave access rights under component services for Microsoft Excel application now I am getting this error.
Here is some information regarding this
1. Gave rights to ASPNET and network service to my web app directory to try to fix this error.
2. The exact same process works on my Windows 2003 server and my Windows 7 development machine. I am trying to get this going on a different windows 2003 machine that is outside of our domain.
3. Developing on windows 7 64 bit with office 2010 installed. Also excel 2010 is installed on my Web server
4. Here is the code that is causing the error: The last line is causing the error.:
MyXl = new Microsoft.Office.Interop.Excel.Application();
MyXl.Visible = false;
MyWb = (Microsoft.Office.Interop.Excel._Workbook)(MyXl.Workbooks.Add(Missing.Value));
int test = 0;
MySheet = (Microsoft.Office.Interop.Excel._Worksheet)MyXl.ActiveSheet;
int InRow = 2;
for (int i = 0; i < NumberOfColumns; i++)
MySheet.Cells[1, i + 1] = reader.GetName(i);
for (int j = 0; j < NumberOfColumns; j++)
MySheet.Cells[InRow, j + 1] = reader.GetValue(j).ToString();
InRow = InRow + 1;
MySheet.get_Range("A1", "Z1").Font.Bold = true;
MyRange = MySheet.get_Range("A1", "Z1");
string FullPath = Url + Filename;
MyWb.SaveAs(FullPath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, null, null, false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, false, false, null,null,null);
Aug 02, 2010 08:27 PM|LINK
Aug 12, 2010 01:07 PM|LINK
which line is causing the error?
Aug 12, 2010 01:27 PM|LINK
the last one. Line 34.
It's some security issue somewhere. This whole server is all weird.
Aug 12, 2010 04:58 PM|LINK
Did you check if it's a permission issue? It's possible that you are trying to save the file to a location and .NET doesn't have the permissions to write to that location.
Dec 29, 2010 05:39 AM|LINK
Hello. to solve this problem do this works:
Jan 05, 2011 10:11 PM|LINK
I have recently inherited an app developed by someone else that we migrated to a windows 2008 server and after working through a bunch of the errors around excel automation on this server vs our old server I have finally gotten stuck with this same exception.
Moslem522, I have found your response on multiple forums around this error and applied your suggestion and I still recieve the same error, is there anything else I should look into?
Dec 03, 2012 02:13 PM|LINK
Hello, I have solved my problem using your suggest, but can you explain me why I must create the folder 'DESKTOP"? What is the real problem? Thank you very much.