Export with VB to Excel and update file
- by Filipe Costa
Hello.
This is the code that i have to export data to Excel.
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "ID"
oSheet.Range("B1").Value = " Nome"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = CStr(Request("ID"))
oSheet.Range("B2").Value = "John"
oBook.SaveAs("C:\Book1.xlsx")
oExcel.Quit()
I can create and save the excel file, but i can't update the contents.
How can i do it?
Thanks.