Export with VB to Excel and update file
        Posted  
        
            by Filipe Costa
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Filipe Costa
        
        
        
        Published on 2010-06-02T09:27:08Z
        Indexed on 
            2010/06/02
            9:33 UTC
        
        
        Read the original article
        Hit count: 302
        
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.
© Stack Overflow or respective owner