Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net host and download an Excel 2003 spreadsheet with macros

Hi

In an ASP.net website is it possible to include an Excel 2003 spreadsheet  (with VBA code) that can first be populated with data from a database (Access) table already hosted on the website and can this
spreadsheet be downloaded onto the users computer so that the VBA code can be run there.
Thanks

The code below is just an example of uploading a spreadsheet - I need the download code if possible
Protected Sub ButtonUploadFile_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonUploadFile.Click
        Try
            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
        Catch ex As Exception
            MsgBox(Err.Description)
        End Try
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mlanda T
Mlanda T
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thank you very much for the detailed answer.Really appreciate it