Tuesday, February 15, 2011

Get Cell Data

Dim objExcel
Dim oSheet
'Create an object for Excel Application
Set objExcel = WScript.CreateObject("Excel.Application")
Set temp = objExcel.Workbooks.Open("C:\Documents and Settings\deepakpe\Desktop\Mine_doc\new.xlsx")

'Loop to go through each cell n get the data

Dim intRow , intCol
intRow = 1 : intCol = 1
WScript.Echo " Coloumn : Data "

Do Until objExcel.Cells(intRow,intCol).Value = ""
    Do Until objExcel.Cells(intRow, intCol) = ""
        WScript.Echo   objExcel.Cells(intRow, intCol).Value
        intRow = intRow + 1
    Loop
    WScript.Echo " "
     intCol = intCol + 1
     intRow = 1
Loop

objExcel.Workbooks.Close ()
objExcel.Quit

'Release the object
Set objExcel = Nothing

No comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | JCpenney Printable Coupons