Murray Brown
asked on
ASP.net Excel versions
Hi
The following code works with .xls (or 2003 and older file). How do I upgrade it to work with .xlsm and .xlsx files too?
The following code works with .xls (or 2003 and older file). How do I upgrade it to work with .xlsm and .xlsx files too?
Protected Sub ButtonUploadFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles ButtonUploadFile.Click
If FileUploadExcel.HasFile Then
Try
' alter path for your project
FileUploadExcel.SaveAs(Server.MapPath("~/ExcelImport.xls"))
LabelUpload.Text="Upload File Name: " & _
FileUploadExcel.PostedFile.FileName & "<br>" & _
"Type: " & _
FileUploadExcel.PostedFile.ContentType & _
" File Size: " & _
FileUploadExcel.PostedFile.ContentLength & " kb<br>"
Catch ex As Exception
LabelUpload.Text="Error: " & ex.Message.ToString
End Try
Else
LabelUpload.Text="Please select a file to upload."
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER