Friday, June 6, 2008

Working With Excell

Here I am discussing
How to create a Excel Sheet
Storing the data into Excel Sheet
Reading the data from Excel Sheet

Creation of Excel Sheet -

Set Excel=CreateObject("Excel.Activation")
Set ExcelSheet=CreateObject("Excel.sheet")
ExcelSheet.Application.visible=true

Storing the data into Excel Sheet -

Excel.ActiveSheet.Cells(1,1).Value="UserName"
Excel.ActiveSheet.Cells(1,2).Value="Password"
Excel.ActiveSheet.Cells(2,1).Value="arunsingh"
Excel.ActiveSheet.Cells(2,2).Value="rajaputra"
ExcelSheet.SaveAs "C:\text.xls"
datatable.Import "C:\text.xls" 'Importing excel sheet into datatable

Reading the data from Excel Sheet -

msgbox "UserName is="+Excel.ActiveSheet.Cells(2,1)
msgbox "Password is="+Excel.AcitveSheet.Cells(2,2)

No comments:

Post a Comment