Hi every body, I am new to QTP.pls help me if anybody knows
the solution.
Here is my doubt:
I have 3 excel sheets in my local drive out of which one is
password protected and i want to get the data of all these
xL's either by importing or by reading the data finally i
have to update this data in the website.(and the site is
secured site)
I tried by importing all XL"s one by one but couldn't do so.
plss send me the code or atleast suggest me the approach.
Thanks in Advance
Padmaja
Answer Posted / swapna
Hi ,
There is simple solution which you need to do is try to
access the excel through by creating the object.
See sample script
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Function HomePage()
Dim fso, Root, HtmlResFile
Dim appExcel
'Defining the File object
Set fso = CreateObject("Scripting.FileSystemObject")
Set appExcel = CreateObject("Excel.Application")
'Setting the path
'Root = "C:\\Documents and Settings\\sragi\\Desktop\\MCGATF-
WALTHAM\\KR2xRegressionSet_Framework\\"
'Root = App.Path + "\KR2xRegressionSet_Framework"
Root = App.Path
ExcelPath = Root + "\\Qtp_Excel_Results\\Results.xlsx"
'Creating html file
Set HtmlResFile = fso.CreateTextFile(Root
+ "\Qtp_Html_Results\Regression_Summary_Results.html",
True, False)
'Closing the Html created file
HtmlResFile.Close
'Opening the above created html file for writing
Set HtmlResFile = fso.OpenTextFile(Root
+ "\Qtp_Html_Results\Regression_Summary_Results.html", 2,
True)
Set appExcel = CreateObject("Excel.Application")
'Open the Result file
appExcel.Visible = True
Set objWorkBook = appExcel.Workbooks.Open(ExcelPath)
'Open the Result file
Set objSheet = appExcel.Sheets(1)
objSheet.Select
With objSheet
TotalExecutedTcs = .Range("C7")
End With
For j = 11 To objSheet.UsedRange.Rows.Count
Status = objSheet.Range("G" & j)
If Status = "Pass" Then
Passcount = Passcount + 1
Else
Failcount = Failcount + 1
End If
Next
TotalPass_Percentage = Round((Passcount * 100) /
TotalExecutedTcs)
TotalFail_Percentage = Round((Failcount * 100) /
TotalExecutedTcs)
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
this function will read the data from the excel and reports
to the html output. This is not the direct solution of your
problem but the methods which are used will solve your
problem...
Search in google to read the excel which has password
protection. Already I have posted the code in the QTP Blog
earlier.... along with it you can get other experts code...
Thanks..
Happy learning...
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
what is run action?
Please guide me release notes of Automation once scripts are completed
What are the different types of recording modes?
Hai anyone please "Explain about Framework in QTP?"
Hi, is it possible for recording shortcut key during record session? The application on which I am working is web based application. This application has several shortcut key associated with menu option. I have succesfully recorded all menu option but unable to record shortcut key.
What is action?
i need to add 1000 users in a domain i written the script for that and it is running successfuly but the problem is that my system is not the user of that domain in which i have to add users so for adding users in that domain i have to install qtp on that another system, can anybody suggest me the way to add those users from my system ultimately i want to know how to access remote computer through script
your coming from electrical backgroung..but y ur coming to software side?
What is QTP and the use of QTP in TD?
Hi any body pls help me for QTP 11.0 software free demo version. i have to practice. Kindly send the link.or where i have to download.
What is checkpoints for quicktest professional (qtp)?
What are the different types of recording modes in qtp? Which will be used when?
HOW AUTOMATE TEST SCRIPT ? what time it will do? after gneration of basic script or Any , Plz explain detailed?
If there is a change in the object type eg: A button is changed as link, 1. How to edit that in the shared object repository. 2.What options are available to edit the object within shared object repository other than copy from loca; 3.What would be the effect of the change in Coded Scripts within QTP and Functions stored in .vbs file which are loaded and used in QTP
How does QTP identify an object?