12-29-2010, 05:03 PM
(This post was last modified: 12-29-2010, 05:08 PM by joe.venom13.)
Hi,
You can use the following code to store the data in excel:
You can use the following code to store the data in excel:
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False
Set objWorkbook = objExcel.WorkBooks.Open("path of the file.xls") 'this is the name of the excel file
Set objDriverSheet = objWorkbook.Worksheets("Sheet1") 'this is the sheet name in the excel file
columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
i = rowcount
If rowcount = 1 Then
objWorkbook.Sheets("Sheet1").Cells(i,1).Value = a
objWorkbook.Sheets("Sheet1").Cells(i,2).Value = b
Else
i = i+1
objWorkbook.Sheets("Sheet1").Cells(i,1).Value = a
objWorkbook.Sheets("Sheet1").Cells(i,2).Value = b
End If
objWorkbook.Save
objWorkbook.Close
objExcel.Quit