Posted on: 3/18/2011 2:07:44 AM | Views : 290

I have a link on my website to download an Excel 2007 file. It opens up the file in Excel, but a sharing violation occurs when you try to save. "Save As" works fine though.
Here is my code:
Sub BuildingReport2() 'Get path for file Dim strPath As String = Server.MapPath("SpreadsheetReports") Dim fileName As String = "BuildingsReport.xlsx" Dim docFileName As String = Path.Combine(strPath, fileName) Dim ext As String = Path.GetExtension(docFileName) Dim type As String = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" 'Send file to browser Response.Clear() Response.AddHeader("content-disposition", "attachment; filename=Buildings.xlsx") Response.ContentType = Type Response.WriteFile (docFileName) Response.End() End Sub Thanks for your help!
...

Go to the complete details ...