How can we open an Excel sheet through the script

Answers were Sorted based on User's Feedback



How can we open an Excel sheet through the script..

Answer / uday kumar_anem

If you want to open Excel sheet using QTP, follow the below
script:
Dim objexcel
Set objExcel = createobject("Excel.application")

Set objWB = objExcel.Workbooks.Open("FileName")
Set objWS = objExcel.ActiveWorkbook.Worksheets("SheetName")
objexcel.Visible = True

Is This Answer Correct ?    33 Yes 4 No

How can we open an Excel sheet through the script..

Answer / sreekanth chilam

HI All,

Try for this three ways given below :

1.
SystemUtil.Run "excelsheet path"

2.
Dim xl
Set xl=CreateObject("Excel.Application")
xl.Visible=True
xl.WorkBooks.Open "ExcelSheet path"
xl.ActiveWorkBook.Save
xl.Application.Quit
Set xl=Nothing

3.Dim xl
Set xl=CreateObject("WScript.Shell")
xl.Run "Excel.exe"

Is This Answer Correct ?    10 Yes 2 No

How can we open an Excel sheet through the script..

Answer / tvsramakrishnachowdary

Hi Chandra sekhar...

Every time ur approach is abt recording...pls try to avoid
that..it will creates u prob in the real time..ok...

follow following code...
-----------------------------
set xa=createobject("excel.application")
set xb=xa.workbooks.open("d:\sample.xls")
set xs=worksheets("sheet1")
val=xs.cells(1,1).value
msgbox val

NOTE:here (1,1)--->1st row,1st column

Is This Answer Correct ?    3 Yes 1 No

How can we open an Excel sheet through the script..

Answer / arv

Try this out..It worked form me.. http://www.ibm.com/developerworks/linux/library/l-pexcel/

Is This Answer Correct ?    0 Yes 3 No

How can we open an Excel sheet through the script..

Answer / mukesh raghav

We can open a excel sheet from the given location.
First you write a script in ksh shell and mentioned the
actual path of the sheet and try to run your script.

Is This Answer Correct ?    0 Yes 5 No

How can we open an Excel sheet through the script..

Answer / bhaskar pothuri

This question is related to automation. As an example we
can open an excel sheet in QTP using the library functions
available in the VB scripting.

Is This Answer Correct ?    9 Yes 16 No

How can we open an Excel sheet through the script..

Answer / k.chandra sekhar

a) In QTP data table have two types of the Excel sheet.
b) If the extra Excel sheet wants then you create in
the data table window in QTP. This facility is possible in
QTP data table window.
c) If you want script to excel sheet then start the
record and open the one new excel sheet then stop the
record after check script. That is the script of the excel
sheet.
d) Once do this function of the excel sheet. if you
get the scripts.



My name is k.chandra sekhar,
My phone no is 09246540049,
Hyderabad.
My mail id is ndra_143@yahoo.co.in
If any body want full explain send the mail

Is This Answer Correct ?    4 Yes 16 No

How can we open an Excel sheet through the script..

Answer / srikanth

InvokeApplication("C:\Documents and Settings\All
Users\Start Menu\Programs\ExcellSheet")

Is This Answer Correct ?    1 Yes 14 No

Post New Answer

More QTP Interview Questions

How to fetch web elements count from Google Page which contains letter "e"

4 Answers  


Can anyone explain me about child objects in detail;when they are used and why do we need them ? please give me sample code for this if possible.

1 Answers   Virtusa,


how to test a java project throughqtp?while testing a vb project we generally do vb scripting. but while testing java project do we use java script .plz some one can send me the manual for it my email roy_samata@yahoo.com thanks in advance

1 Answers  


Hi All Below is my script which i made for lgin into Flight.exe. SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open" Dialog("Login").WinEdit("Agent Name:").Set DataTable ("p_Text", dtGlobalSheet) Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure DataTable ("p_Text1", dtGlobalSheet) Dialog("Login").WinButton("OK").Click If Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").Click datatable.Value(3)= "Incorrect password. Please try again" Dialog("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)="Please enter agent name" Dialog ("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)= "Please enter password" Dialog("Login").WinButton ("CANCEL").Click else Window("Flight Reservation").Move 309,146 datatable.ExportSheet "C:\Raj\Result.xls" ,1 Window("Flight Reservation").Close End If I want to capture the Message string from Dialog("Login").Dialog("Flight Reservations" Also pls let me know if this is the right way to do the script for login. Pls provide some script for login Flight.exe Thanks in advance Raj Dhiman

1 Answers  


How Does Run time data (Parameterization) is handled in QTP?

2 Answers   Crea,






What is the limitation to XML Checkpoints?

1 Answers  


What is action?

0 Answers  


does QTP provides any tools for parametrisation?

4 Answers  


How to retrieve alpha bate from the alphanumeric string with special character.

7 Answers   ADP, Cap Gemini,


what is stlc and its contents?

1 Answers  


What is the new version of qtp which is recently released in the market?

0 Answers  


Explain QTP Testing process ?

13 Answers   TCS,


Categories