''We can do excel operations using excel object model. To find excel object model in your system follow these steps..
'*********** ********* ********* ********* *
'creating an excel application object
Set Excel=CreateObject( "Excel.Application")
'Adding a sheet in that application
Set ExcelSheet = CreateObject( "Excel.Sheet" )
' Make Excel visible through the Application object.
ExcelSheet.Application.Visible = True
'Adding value into sheet
For i=1 to 10
ExcelSheet.ActiveSheet.Cells( i,1).Value = "This is column A, row"&i
Next
' Save the sheet.
ExcelSheet.SaveAs "C:\TEST.xls"
' Close Excel with the Quit method on the Application object.
ExcelSheet.Applicat ion.Quit
' Release the object variable.
Set ExcelSheet = Nothing
'*********** ********* ********* ********* *
''Copy this script in .vbs file and double click on it or paste this script in QTP and execute it.
''After that go C:\ drive you will find an excel application in the name of TEST.xls..
''Try to understand this by referring excel object model.. Revert me for any concerns..
Important Topics & Useful Scripts on QTP. Ask your QTP related questions at this id - asrajaputra@gmail.com
Showing posts with label Working with Excel. Show all posts
Showing posts with label Working with Excel. Show all posts
Saturday, December 6, 2008
To Insert a Value in a Exce l Sheet
''''''''''''''''''''To Insert a Value in a Exce l Sheet'''''''''''''''''''''''''
Set xl=createobject("Excel.Application")
Set x=xl.workbooks.open("c:/arun.xls")
Set y=xl.activeworkbook.worksheets("sheet1")
xl.cells(1,1)="arun"
Set xl=createobject("Excel.Application")
Set x=xl.workbooks.open("c:/arun.xls")
Set y=xl.activeworkbook.worksheets("sheet1")
xl.cells(1,1)="arun"
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)
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)
Subscribe to:
Posts (Atom)
About Me
- RAJAPUTRA
- Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.
Subscribe to get updates on this blog
NOTE
Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.