Tuesday, 29 March 2011

Get cell data from Excel File


'Create Excel Application object
Set suitExcelobj= CreateObject("Excel.Application")
'Open the Excel Work book
    Set suitExcelWorkbook=suitExcelobj.Workbooks.Open(suitEXCELPath)
'Open a particular sheet
    Set suitExcelWorkSheet=suitExcelobj.WorkSheets("Scenario1")
'Activate the sheet
    suitExcelWorkSheet.Activate
'Set the alerts to False
    suitExcelobj.DisplayAlerts = false
    If Err.Number>0 Then
       msgbox "Error in the Suite Excel"
       ExitRun(0)
    end if
'Get the total row count
    RowsCount =suitExcelobj.ActiveSheet.UsedRange.Rows.Count
'Get the values from the excel application
    x= suitExcelobj.Cells(1,2).Value

No comments:

Post a comment